답안 #1079057

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1079057 2024-08-28T10:09:19 Z oscar1f Tiles (BOI24_tiles) C++17
15 / 100
41 ms 10580 KB
#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;
    if (direc==0) {
        //cout<<"RETOURNE"<<endl;
        for (int i=0;i<nbPoints/2;i++) {
            swap(points[i],points[nbPoints-1-i]);
        }
    }
    /*for (int i=0;i<nbPoints;i++) {
        cout<<points[i].first<<" "<<points[i].second<<endl;
    }*/
    int rep=maxX;
    for (int i=1;i<nbPoints;i++) {
        if (points[i].second%2!=yMin%2) {
            rep=min(rep,points[i-1].first);
        }
        if (points[i].first%2!=xMin%2) {
            rep=min(rep,points[i].first-1);
        }
    }
    cout<<rep<<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;
}
 
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 464 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Incorrect 1 ms 348 KB Output isn't correct
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 6 ms 1884 KB Output is correct
3 Correct 27 ms 8420 KB Output is correct
4 Correct 16 ms 4700 KB Output is correct
5 Correct 15 ms 4636 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 29 ms 8924 KB Output is correct
9 Correct 17 ms 5272 KB Output is correct
10 Correct 32 ms 8784 KB Output is correct
11 Correct 15 ms 4188 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 31 ms 8960 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 16 ms 4744 KB Output is correct
3 Correct 15 ms 5060 KB Output is correct
4 Correct 31 ms 7772 KB Output is correct
5 Correct 19 ms 7772 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 472 KB Output is correct
8 Correct 29 ms 10132 KB Output is correct
9 Correct 41 ms 10324 KB Output is correct
10 Correct 28 ms 10328 KB Output is correct
11 Correct 28 ms 10324 KB Output is correct
12 Correct 29 ms 10064 KB Output is correct
13 Correct 29 ms 10320 KB Output is correct
14 Correct 32 ms 10548 KB Output is correct
15 Correct 29 ms 10324 KB Output is correct
16 Correct 28 ms 10324 KB Output is correct
17 Correct 31 ms 10324 KB Output is correct
18 Correct 29 ms 10324 KB Output is correct
19 Correct 29 ms 10504 KB Output is correct
20 Correct 32 ms 10324 KB Output is correct
21 Correct 28 ms 10004 KB Output is correct
22 Incorrect 31 ms 10580 KB Output isn't correct
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 6408 KB Output is correct
2 Correct 14 ms 3420 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 464 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Incorrect 1 ms 348 KB Output isn't correct
25 Halted 0 ms 0 KB -