Submission #49681

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
496812018-06-02 05:32:34mra2322001Schools (IZhO13_school)C++14
100 / 100
131 ms25632 KiB
#include <bits/stdc++.h>
#define f0(i, n) for(int i(0); i<(n); i++)
#define f1(i, n) for(int i(1); i<=(n); i++)
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
const int N = 300002;
int n, s, t;
long t1[N], t2[N];
pii a[N];
istream& operator >> (istream &is, pii &iu){
cin >> iu.first >> iu.second;
}
int main(){
ios_base::sync_with_stdio(0);
cin >> n >> s >> t;
f1(i, n) cin >> a[i];
sort(a + 1, a + n + 1, [&](pii a1, pii a2){
return (a1.second - a1.first) < (a2.second - a2.first);
});
priority_queue <int, vector <int>, greater <int> > q;
f1(i, n){
if(q.size() < s){
t1[i] = t1[i - 1] + a[i].first;
q.push(a[i].first);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

school.cpp: In function 'std::istream& operator>>(std::istream&, pii&)':
school.cpp:16:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
school.cpp: In function 'int main()':
school.cpp:28:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(q.size() < s){
            ~~~~~~~~~^~~
school.cpp:43:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(q.size() < t){
            ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...