# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
757968 | Adrian_Soriaga | Towers (NOI22_towers) | C++14 | 1 ms | 436 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
# | 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... |