Submission #1079044

#TimeUsernameProblemLanguageResultExecution timeMemory
1079044oscar1fTiles (BOI24_tiles)C++17
4 / 100
31 ms10328 KiB
#include<bits/stdc++.h> using namespace std; #define int long long const int INFINI=1000*1000*1000+5,TAILLE_MAX=200*1000+5; int nbPoints,maxX; pair<int,int> initPoint[TAILLE_MAX]; pair<int,int> points[TAILLE_MAX]; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>nbPoints>>maxX; int xNouv,yNouv,posMin=0,xMin=INFINI,yMin=INFINI; for (int i=0;i<nbPoints;i++) { cin>>xNouv>>yNouv; if (xNouv<xMin or (xNouv==xMin and yNouv<yMin)) { posMin=i; xMin=xNouv; yMin=yNouv; } initPoint[i]={xNouv,yNouv}; } int posCour,direc=-1,nbPris=1; points[0]={xMin,yMin}; for (int i=1;i<=nbPoints;i++) { //cout<<direc<<" "<<nbPris<<endl; posCour=(posMin+i)%nbPoints; if (points[nbPris-1].first==initPoint[posCour].first) { if (direc==0) { points[nbPris-1].second=initPoint[posCour].second; //cout<<0<<" "<<initPoint[posCour].first<<" "<<initPoint[posCour].second<<endl; } else { direc=0; points[nbPris]=initPoint[posCour]; nbPris++; } } else { if (direc==1) { //cout<<1<<" "<<initPoint[posCour].first<<" "<<initPoint[posCour].second<<endl; points[nbPris-1].first=initPoint[posCour].first; } else { direc=1; points[nbPris]=initPoint[posCour]; nbPris++; } } } nbPoints=nbPris; /*for (int i=0;i<nbPoints;i++) { cout<<points[i].first<<" "<<points[i].second<<endl; }*/ if (points[0].second%2==points[2].second%2) { if (points[0].first%2==points[2].first%2) { cout<<points[2].first<<endl; } else { cout<<points[2].first-1<<endl; } } else { cout<<xMin<<endl; } return 0; }
#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...