Submission #1590287
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;
void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
return os<<'('<<p.first<<','<<p.second<<')';
}
template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
print_tuple<0,Args...>(os<<'(',t);
return os<<')';
}
template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
os<<'[';
for(auto i=begin(c);i!=end(c);++i)
os<<(i==begin(c)?"":" ")<<*i;
return os<<']';
}
constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;
int main()
{
#ifndef _GLIBCXX_DEBUG
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
constexpr char endl='\n';
#endif
for(ll n,k;cin>>n>>k&&n|k;){
vl f(100001),g(100002);
rep(i,n){
int a,b; cin>>a>>b;
f[a]+=b;
}
rep(i,f.size()) g[i+1]=g[i]+f[i];
int res=upper_bound(all(g),k-1)-begin(g)-1;
cout<<res<<endl;
}
}
Submission Info
Submission Time |
|
Task |
C - Big Array |
User |
lyoz |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
2036 Byte |
Status |
AC |
Exec Time |
18 ms |
Memory |
1792 KB |
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 |
2 ms |
1792 KB |
sample_02.txt |
AC |
2 ms |
1792 KB |
subtask_1_1.txt |
AC |
2 ms |
1792 KB |
subtask_1_10.txt |
AC |
18 ms |
1792 KB |
subtask_1_11.txt |
AC |
17 ms |
1792 KB |
subtask_1_12.txt |
AC |
17 ms |
1792 KB |
subtask_1_13.txt |
AC |
17 ms |
1792 KB |
subtask_1_14.txt |
AC |
17 ms |
1792 KB |
subtask_1_15.txt |
AC |
18 ms |
1792 KB |
subtask_1_2.txt |
AC |
3 ms |
1792 KB |
subtask_1_3.txt |
AC |
7 ms |
1792 KB |
subtask_1_4.txt |
AC |
12 ms |
1792 KB |
subtask_1_5.txt |
AC |
17 ms |
1792 KB |
subtask_1_6.txt |
AC |
2 ms |
1792 KB |
subtask_1_7.txt |
AC |
2 ms |
1792 KB |
subtask_1_8.txt |
AC |
3 ms |
1792 KB |
subtask_1_9.txt |
AC |
9 ms |
1792 KB |