Submission #666766

#TimeUsernameProblemLanguageResultExecution timeMemory
666766ktkeremTriangles (CEOI18_tri)C++17
Compilation error
0 ms0 KiB
/*#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 cmp(ll a ,ll b){
    return is_clockwise(1 , a , b);
}
void solve(){
    n = get_n();
    dvd[0].pb(2);
    dvd[1].pb(2);
    for(ll i =3;n>i;i++){
        dvd[cmp(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();
            if(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.begin() , 1);
    }
    if(std::min(hul[0].size() , hul[1].size())){
        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;
}/**/

Compilation message (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 'void solve()':
tri.cpp:50:27: error: request for member 'begin' in 'hul', which is of non-class type 'std::vector<long long int> [2]'
   50 |         hul[i].insert(hul.begin() , 1);
      |                           ^~~~~
tri.cpp: In function 'int main()':
tri.cpp:85:8: warning: unused variable 'o' [-Wunused-variable]
   85 |     ll o = 1;
      |        ^