Submission #847899

#TimeUsernameProblemLanguageResultExecution timeMemory
847899vjudge1Unija (COCI17_unija)C++17
10 / 100
565 ms16212 KiB
#include <bits/stdc++.h> using namespace std; int main() { long long n,cnt=0; cin>>n; // int x[n],y[n]; vector<pair<long long,long long>>v(n); for(int i=0 ; i<n ; i++) { long long xx,yy; cin>>xx>>yy; yy/=2;xx/=2; v[i]={xx,yy}; } /*int mxxx=0,mxxy=0,mxyx=0,mxyy=0; for (int i=0 ; i<n ; i++) { if(x[i]>mxxx) { mxxx=x[i]; mxxy=y[i]; } if(x[i]==mxxx) { mxxy=max(mxxy,y[i]); } if(y[i]>mxyy) { mxyx=x[i]; mxyy=y[i]; } if(y[i]==mxyy) { mxyx=max(mxyx,x[i]); } } if(mxxx==mxyx && mxxy==mxyy) { cout<<mxxx*mxxy<<endl; return 0; }*/ // cnt+=mxxx*mxxy; // mxyy-=mxxy; // cnt+=mxyy*mxyx; sort(v.begin(),v.end()); /*for (int i=0 ; i<v.size()-1 ; i++) { if(v[i].first==v[i+1].first) { v.erase(v.begin()+i); i--; } }*/ /*for (int i=1 ; i<v.size() ; i++) { if(v[i].second<v[i-1].second && v[i].first==v[i-1].first) { v.erase(v.begin()+i); i--; } }*/ reverse(v.begin(),v.end()); /*int j=0; for(int i=0 ; i<n ; i++) { cnt+=v[i].first*(v[i].second-j); // cout<<v[i].first<<" "<<v[i].second<<" "<<j<<" "; // cout<<cnt<<endl; j=v[i].second; }*/ // int j=v[0].second,k=0,h=v[0].first; // int j=v[v.size()-1].second,k=v.size()-1; int j=0,k=0; cnt=0; // cout<<v[0].first<<" "; /*for (int i=0 ; i<n; i++) { cout<<v[i].first<<" "<<v[i].second<<endl; }*/ for(int i=v[0].first ; i>0 ; i--) { // cout<<v[j+1].first<<" "; if(i==v[k].first && v[k].second>v[j].second) j=k; if (i==v[k].first)k++; cnt+=v[j].second; // cnt+=v[i].second*(v[i].first-v[i-1].first); // cout<<cnt<<"\n"; } cout<<cnt*4<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...