Submission #1279079
Source Code Expand
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
#define int long long
signed main() {
int n, k; scanf("%lld%lld", &n, &k);
vector<P>v;
rep(i, n) {
int a, b; scanf("%lld%lld", &a, &b);
v.push_back(P(a, b));
}
sort(v.begin(), v.end());
int cnt = 0;
for (auto p : v) {
if (cnt + p.second >= k) {
cout << p.first << endl;
return 0;
}
cnt += p.second;
}
}
Submission Info
Submission Time
2017-05-13 21:06:09+0900
Task
C - Big Array
User
autumn_eel
Language
C++14 (GCC 5.4.1)
Score
300
Code Size
583 Byte
Status
AC
Exec Time
25 ms
Memory
1400 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:13:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int n, k; scanf("%lld%lld", &n, &k);
^
./Main.cpp:16:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int a, b; scanf("%lld%lld", &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
1 ms
256 KB
subtask_1_10.txt
AC
25 ms
1400 KB
subtask_1_11.txt
AC
25 ms
1400 KB
subtask_1_12.txt
AC
24 ms
1400 KB
subtask_1_13.txt
AC
22 ms
1400 KB
subtask_1_14.txt
AC
21 ms
1400 KB
subtask_1_15.txt
AC
21 ms
1400 KB
subtask_1_2.txt
AC
2 ms
256 KB
subtask_1_3.txt
AC
9 ms
640 KB
subtask_1_4.txt
AC
17 ms
892 KB
subtask_1_5.txt
AC
25 ms
1400 KB
subtask_1_6.txt
AC
1 ms
256 KB
subtask_1_7.txt
AC
1 ms
256 KB
subtask_1_8.txt
AC
3 ms
384 KB
subtask_1_9.txt
AC
11 ms
892 KB