제출 #757968

#제출 시각아이디문제언어결과실행 시간메모리
757968Adrian_SoriagaTowers (NOI22_towers)C++14
5 / 100
1 ms436 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int a,b,n,x,y; cin>>n;
    vector<vector<int>> towers(3);
    for (int i=0;i<n;i++){
        cin>>a>>b; towers[i].push_back(a);towers[i].push_back(b); 
    }
    if (n==1){
        cout<<"1";
    }
    else if (n==2){
        cout<<"11";
    }
    else{
    vector<string> ans= {"0","0","0"};
    string s= "";
        if (towers[0][0] == towers[1][0] && towers[2][0] == towers[1][0]){
            x = max(towers[0][1], max(towers[1][1],towers[2][1])); y = min(towers[0][1], min(towers[1][1],towers[2][1]));             for (int i =0; i<3;i++){
            if (towers[i][1] == x) {ans[i] = "1";} if (towers[i][1] == y) {ans[i] = "1";}
            }
            for (int i =0;i<3;i++){s+=ans[i];} cout<<s;
        }
        else if (towers[0][1] == towers[1][1] && towers[2][1] == towers[1][1]){
            x = max(towers[0][0], max(towers[1][0],towers[2][0])); y = min(towers[0][0], min(towers[1][0],towers[2][0])); 
            for (int i =0; i<3;i++){
            if (towers[i][0] == x) {ans[i] = "1";} if (towers[i][0] == y){ans[i] = "1";}
            }
            for (int i =0;i<3;i++){s+=ans[i];} cout<<s;
        }
        else{ cout<<"111";}
    }
}
#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...