This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |