Submission #1279088
Source Code Expand
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
#include <ctime>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;
ll N, K;
ll cnt[112345];
int main() {
cin >> N >> K;
REP(i, N) {
int a, b;
scanf("%d %d", &a, &b);
cnt[a] += b;
}
ll now = 0;
REP(i, 112345) {
if (now + cnt[i] >= K) {
printf("%d\n", i);
break;
}
now += cnt[i];
}
return 0;
}
Submission Info
Submission Time
2017-05-13 21:06:13+0900
Task
C - Big Array
User
tkmst201
Language
C++14 (GCC 5.4.1)
Score
300
Code Size
1136 Byte
Status
AC
Exec Time
19 ms
Memory
1024 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:43:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &a, &b);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
300 / 300
Status
Set Name
Test Cases
Sample
sample_01.txt, sample_02.txt
All
sample_01.txt, sample_02.txt, subtask_1_1.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt, subtask_1_8.txt, subtask_1_9.txt
Case Name
Status
Exec Time
Memory
sample_01.txt
AC
1 ms
256 KB
sample_02.txt
AC
1 ms
256 KB
subtask_1_1.txt
AC
2 ms
1024 KB
subtask_1_10.txt
AC
19 ms
1024 KB
subtask_1_11.txt
AC
18 ms
384 KB
subtask_1_12.txt
AC
18 ms
256 KB
subtask_1_13.txt
AC
17 ms
256 KB
subtask_1_14.txt
AC
17 ms
256 KB
subtask_1_15.txt
AC
19 ms
256 KB
subtask_1_2.txt
AC
2 ms
1024 KB
subtask_1_3.txt
AC
7 ms
1024 KB
subtask_1_4.txt
AC
13 ms
1024 KB
subtask_1_5.txt
AC
18 ms
1024 KB
subtask_1_6.txt
AC
1 ms
256 KB
subtask_1_7.txt
AC
2 ms
896 KB
subtask_1_8.txt
AC
3 ms
1024 KB
subtask_1_9.txt
AC
9 ms
1024 KB