이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
#include<bits/stdc++.h>
#include<trilib.h>
/**/
//typedef int ll;
typedef long long ll;
typedef unsigned long long ull;
typedef std::string str;
/*typedef __int128 vll;
typedef unsigned __int128 uvll;*/
#define llll std::pair<ll , ll>
#define pb push_back
#define pf push_front
#define halo cout << "hello\n"
#define fi first
#define sec second
#define all(a) a.begin() , a.end()
const ll limit = 1e9+7;
const ll ous = 1e6 + 7;
const ll dx[4] = {-1 , 0 , 1 , 0} , dy[4] = {0,1,0,-1};
ll n , m;std::vector<ll> ar;
std::vector<ll> dvd[2] , hul[2];
/*ll is_clockwise(ll a ,ll b , ll c){
ll x;
std::cout << a << " " << b << " " << c << "\n";
std::cin >> x;
return x;
//return is_clockwise(1 , a , b);
}*/
ll cmp(ll a ,ll b){
return is_clockwise(1 , a , b);
}
/*void give_answer(ll x){
std::cout << x << "\n";
}*/
void solve(){
//std::cin >> n;
n = get_n();
dvd[0].pb(2);
dvd[1].pb(2);
for(ll i =3;n>=i;i++){
dvd[is_clockwise(1 , 2 , i)].pb(i);
}
for(ll i =0;2>i;i++){
std::sort(all(dvd[i]) , cmp);
for(auto j:dvd[i]){
ll o = hul[i].size();
while(o > 1 && !is_clockwise(hul[i][o-2] , hul[i][o-1] , j)){
hul[i].pop_back();
o--;
}
hul[i].pb(j);
}
if(i == 1){
std::reverse(all(hul[i]));
}
hul[i].insert(hul[i].begin() , 1);
}
if(std::min(hul[0].size() , hul[1].size()) == 2){
give_answer(std::max(hul[0].size() , hul[1].size()));
return;
}
for(ll j = 0;2>j;j++){
hul[0].pop_back();
while(1){
ll o = 1;
ll z = hul[0].size();
if(z>1&&!is_clockwise(hul[0][z-2] , hul[0][z-1] , hul[1].back())){
hul[0].pop_back();
z--;o = 0;
}
z = hul[1].size();
if(z>1&&!is_clockwise(hul[0].back() , hul[1][z-1] , hul[1][z-2])){
hul[1].pop_back();
z--;o = 0;
}
if(o == 1){
break;
}
}
for(ll o = 0;2>o;o++){
std::reverse(all(hul[o]));
}
std::swap(hul[0] , hul[1]);
}
give_answer(hul[0].size() + hul[1].size());
return;/**/
}
signed main(){
ll t=1;
//std::cin >> t;
ll o = 1;
while(t--){
//cout << "Case " << o++ << ":\n";
solve();
}
return 0;
}/**/
컴파일 시 표준 에러 (stderr) 메시지
tri.cpp:5:78: warning: "/*" within comment [-Wcomment]
5 | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
|
tri.cpp: In function 'int main()':
tri.cpp:96:8: warning: unused variable 'o' [-Wunused-variable]
96 | ll o = 1;
| ^
# | 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... |