이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "trilib.h"
#define pb push_back
#define X first
#define Y second
#define pii pair<int, int>
using namespace std;
/*
int get_n(){
int c; cin >> c;
return c;
}
void give_answer(int a){
cout << a;
}
bool is_clockwise(int a, int b, int c){
cout << a << ' '<<b <<' '<<c<<endl;
bool d; cin >> d;
return d;
}
*/
bool ask(int a, int b, int c){
a++; b++; c++;
return is_clockwise(a, b, c);
}
bool cmp(int a, int b){
if(a==b)return 0;
return !ask(0, a, b);
}
int main(){
ios_base::sync_with_stdio(false);
int n; n = get_n();
//if(n==3)give_answer(3);
vector<int> up, dw, hull;
up.pb(1);
for(int i = 2; i < n; i++){
if(ask(0, 1, i))up.pb(i);
else dw.pb(i);
}
sort(up.begin(), up.end(), cmp);
sort(dw.begin(), dw.end(), cmp);
up.insert(up.begin(), 0);
for(int i = 0; i < dw.size(); i++){
while(hull.size()>1 && ask(hull.end()[-2], hull.end()[-1], dw[i]))hull.pop_back();
hull.pb(dw[i]);
}
for(int i = 0; i < up.size(); i++){
while(hull.size()>1 && ask(hull.end()[-2], hull.end()[-1], up[i]))hull.pop_back();
hull.pb(up[i]);
}
int sz = hull.size();
for(int i = 0; i < dw.size(); i++){
while(hull.size()>1 && ask(hull.end()[-2], hull.end()[-1], dw[i]))hull.pop_back();
hull.pb(dw[i]);
}
for(int i = 0; i < up.size(); i++){
while(hull.size()>1 && ask(hull.end()[-2], hull.end()[-1], up[i]))hull.pop_back();
hull.pb(up[i]);
}
give_answer(hull.size()-sz);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
tri.cpp: In function 'int main()':
tri.cpp:45:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < dw.size(); i++){
~~^~~~~~~~~~~
tri.cpp:49:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < up.size(); i++){
~~^~~~~~~~~~~
tri.cpp:54:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < dw.size(); i++){
~~^~~~~~~~~~~
tri.cpp:58:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < up.size(); i++){
~~^~~~~~~~~~~
# | 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... |