CSES - Datatähti 2017 loppu - Results
Submission details
Task:Jäätelö
Sender:Senpai
Submission time:2017-01-19 12:50:45 +0200
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:25:1: error: expected '}' at end of input
 }
 ^

Code

#include <bits/stdc++.h>
using namespace std;
int n,x,h,p,g,d;
vector<pair<int,int>>v;
vector<pair<int,int>>s;
vector<pair<int,int>>t;
int main(){
cin>>n>>x;
for(int i=0; i<n; i++){
cin>>h>>p;
v.push_back({p,h});
s.push_back({p*2,h*2});
if(2*h<=x)g=max(p*2,g);
t.push_back({h-p,i});
}
sort(t.begin(),t.end());
sort(t.begin(),t.end());
for(int i=0; i<n; i++){
  for(int j=0; j<n; j++){
if(v[i].second+v[j].second<=x)d=max(d,v[i].first+v[j].first);

}
g=max(g,d);
cout<<g;
}