답안 #844902

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
844902 2023-09-06T08:12:32 Z coding_snorlax 축구 경기장 (IOI23_soccer) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
pair<int,int> process(vector<int> S){
    int L=-1,R=-1,flag = 1;
    for(int i=0;i<(int)S.size();i++){
        if(!S[i] && L==-1){
            L = i; R = i;
        }
        else if(!S[i] && R==i-1){
            R=i;
        }
        else if(!S[i]){
            flag = 0;
        }
    }
    if(!flag) return make_pair(-2,-2);
    return make_pair(L,R);
}
int check_Left(vector<int> List){
    int answer=1,down=0,flag = 0, Last = -1 , next_level = 0;
    for(int i:List){
        if(i==-2) answer=0;
        else if(i==-1 && Last!=-1) flag = 1;
        else{
            if(flag) answer = 0;
            if(Last==-1) Last = i;
            else{
                if(i>Last && next_level==0) next_level = 1;
                else if(i<Last && next_level==1) answer = 0;
            }
            Last = i;
        }

    }
    if(down > 1 || answer==0) return 0;
    else return 1;
}

int check_Right(vector<int> List){
    int answer=1,down=0,flag = 0, Last = -1 , next_level = 0;
    for(int i:List){
        if(i==-2) answer=0;
        else if(i==-1 && Last!=-1) flag = 1;
        else{
            if(flag) answer = 0;
            if(Last==-1) Last = i;
            else{
                if(i<Last && next_level==0) next_level = 1;
                else if(i>Last && next_level==1) answer = 0;
            }
            Last = i;
        }

    }
    if(down > 1 || answer==0) return 0;
    else return 1;
}
int main(){
    vector<int> T = {1,1,0,0,0,1,1,1,1};
    pair<int,int> s = process(T);
    cout << s.first << " " << s.second << "\n";
    vector<int> T2 = {8,6,4,2,3,-1,5,6};
    cout << check_Left(T2);
}

Compilation message

/usr/bin/ld: /tmp/ccfrmwNK.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccBgGJnL.o:soccer.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccfrmwNK.o: in function `main':
grader.cpp:(.text.startup+0x4ac): undefined reference to `biggest_stadium(int, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status