Submission #543719

#TimeUsernameProblemLanguageResultExecution timeMemory
543719ergaganSure Bet (CEOI17_sure)C++17
Compilation error
0 ms0 KiB
/* ........................................````````````````````````.............................------- ...................................````````````````````````````````..........................------- ...................................``````````````````````````````````........--....----......------- .............................`````````````````````````````...```....--.-.--.-.-.://:.----...-------- ...........................````````````````````.``...--..-...`...-:+:--::----//+//--:----...-------- ..........................``````````````````..:.....//:+:..-./:.--:/:/.-.//oy+:-./+:----.----------- ........................``````````````````.-.-o+-.--+oo+----/:-:----:::/oo//o:--.+/:-.-::----------: .......................`.```````````````.--.-:y+-::+o//:./:..-://///+syso+::/::-.::--.:/:-://:--:-:: ......................``````````````..-//:---:/-+o+:-:-.--.--++/::oyhsoso///:::------.::--/o:-::::-: .....................```````````...:+:::-:--:+:-.....-:::://::/+ydhysoo+///:://::---.-----//-/s/:-:+ ......................````````--/:-::-----..-----/::///::---/oydhyyoo+++o+/o+/o+://+/:/:--:--/+:--o+ ....................```````..--::-:-:--///://+oss+-::-:-....:///////++/oo//:::::/osyyyyyo:/--:/:--+: ....................```````/::/-//++oo+++s+//:/o/--..--..//+oyyyyyyso+//::::::--/:::-:/+osyo/---.::- ....................````..-:-:-:+sso/+/:/:-:o++:--:-//:/+hmNNNmdhyso++/-----//:--::-----::/+ss/:-::- ......................--:::::/+sysy+:::::-:+++ss+o:///+//+oshyyyso++/:::::::/o++o++/o++o::::///os:-- ................:-----.:/:/::::////++////++osys++syyhdmmmmdhs+o+://++yhs+hmdmmmNNmddmmNmdsso::--/+ss ................+//:o+o////////:::-::/+//://+oysy+--/ossyhhs+oo+//syyyydhyyysyyyhdddhyyyhdmdyoo+//++ ................:ooyy++/::::++///:/yyhmhs:-sdmdo:--+sosssssssoydmddhhhyyyyhhyddddsssooshyyydddhy++// ................./+//o/+oo+o/++smydMMMMNNmmmmho+oosss++syddddhhhhhyyyo+shdmysmMMMmo+hhysoyyyyyhdhhyo .................:oosyoo//.--ymNMNNMdddysyyyysssshhysssooosysyyyssdmNy+yNNNNmmNMMMNdNNy/+ssyhyysoyys ..................:sys/s..ysdmNmNmmmho///o+syyyyyysysoososyshdNmyomNNNmmNNNNNNNNNNNNMMNo+ysoo+oyysoh ....................-.`.-+mmdddsoo+++osssysooos++++ooyhmmNNmNNhymmmNshNmmmmmNNmmNNNNNNNNdd+++soshmyh .....................`:-sdhyyyo+soyyso+ooo++ooyo/:/ymNNNNNy:oh.`-+yh--yhsommNmmmmdmmNNNMMMsshsosysyy ....................../so+os+sssoos/+::osoo+/+hNmdhyh+smms````````....:o..+mmdmmmmmdmmmNNMmhdhhsooso .....................`:oysyyyyyy+/oyhyo+hmmmdyodNN:.:.`/h:```````.........-o/+ymmmmNmmddmNNNN//syoyy .......................oyysooysmy:/so:////....`-+s-``````.``````..........----yhhhddmNNmdmNNMh/hhs+o ......................../ydd//:-```.``````````````````````````...........-----:yyhmmmmmNmmmmmNyNNy:: ..........................+o.```````````````````````````````...........-------:so/yNNmmmmdNNNNNNMMd/ ............................```````````````````````````````...........--------:/:::ohdmmNmmmmNNNNNMN */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define sz size() #define inf 10e9 #define sp " " #define space cout<<"\n" #define begin begin() #define end end() #define ndl cout<<endl #define rend rend() #define rbegin rbegin() #define pb push_back #define ender return 0; #define yes cout<<"yes"<<endl; #define no cout<<"no"<<endl; #define YESn cout<<"YES\n"; #define NOn cout<<"NO\n"; #define yesn cout<<"yes\n"; #define non cout<<"no\n"; #define Nurmyrza_Quket ios_base::sync_with_stdio(0); cin.tie(NULL); #define T ll t; cin>>t; while(t--) #define Yes cout<<"Yes"<<endl; #define No cout<<"No"<<endl; #define YES cout<<"YES"<<endl; #define NO cout<<"NO"<<endl; #define afor(a) for(ll i=0;i<a;i++) #define a1for(a) for(ll i=1;i<=a;i++) #define vsort(a) sort(a.begin,a.end); #define asort(a,n) sort(a,a+n); #define vsortg(a) sort(a.rbegin,a.rend); #define asortg(a,n) sort(a,a+n,greater<ll>()); #define all(a) a.begin,a.end #define r1for(i,a,b)for(ll i=a;i<=b;i++) #define rfor(i,a,b)for(ll i=a;i<b;i++) #define chd2(n) __builtin_popcount(n)==1; #define ff first #define ss second #define ii pair<ll,ll> #define in insert #define mp make_pair //#define ll int #define ld double const ll LLmn=LLONG_MIN; const ll LLmx=LLONG_MAX; const ll MOD=1e9+7; const ll N=1e6+7; const ld PI=acos(-1.0); const ll K=25; pair <ll,ll> w[9]={mp(-1,0),mp(0,-1),mp(1,0),mp(0,1),mp(-1,-1),mp(0,1),mp(1,-1),mp(1,1)}; //(b + (a%b)) % b (to mod -1%(10^9+7) correctly in c++ its -1 but its suppose to be 10^9+6 bool cvow(char c) { if(c!='a' && c!='e' && c!='i' && c!='o' && c!='u' && c!='y')return 1; else return 0; } void solve() { ll n;cin>>n; ll pick=0; vector<ld>v1,v2; afor(n) { ld a,b;cin>>a>>b; v1.pb(a); v2.pb(b); } vsortg(v1); vsortg(v2); ld o1=0.0,o2=0.0; ld ans=0.0; ll p1=0,p2=0; while(true) { if(p1>=v1.sz && p2>=v2.sz)break; if(p1>=v1.sz) { o2+=v2[p2]; p2++; pick++; ans=max(ans,min(o1-pick,o2-pick)); continue; } if(p2>=v2.sz) { o1+=v1[p1]; p1++; pick++; ans=max(ans,min(o1-pick,o2-pick)); continue; } if(o1==o2) { if(v1[p1]<=v2[p2]) { o1+=v1[p1]; p1++; pick++; } else { o2+=v2[p2]; p2++; pick++; } } else if(o1<=o2) { o1+=v1[p1]; p1++; pick++; } else { o2+=v2[p2]; p2++; pick++; } ans=max(ans,min(o1-pick,o2-pick)); } printf("%.4lf",(double)ans); } int main() { #define JOJ #ifdef JOJo freopen("lca_rmq.in", "r", stdin); freopen("lca_rmq.out", "w", stdout); #endif Nurmyrza_Quket; ll cnt=1; solve(); return 0;

Compilation message (stderr)

sure.cpp: In function 'void solve()':
sure.cpp:110:11: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  110 |      if(p1>=v1.sz && p2>=v2.sz)break;
      |           ^
sure.cpp:110:24: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  110 |      if(p1>=v1.sz && p2>=v2.sz)break;
      |                        ^
sure.cpp:111:11: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  111 |      if(p1>=v1.sz)
      |           ^
sure.cpp:119:11: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  119 |      if(p2>=v2.sz)
      |           ^
sure.cpp: In function 'int main()':
sure.cpp:171:8: warning: unused variable 'cnt' [-Wunused-variable]
  171 |     ll cnt=1;
      |        ^~~
sure.cpp:173:13: error: expected '}' at end of input
  173 |     return 0;
      |             ^
sure.cpp:164:1: note: to match this '{'
  164 | {
      | ^