Submission #1039667

#TimeUsernameProblemLanguageResultExecution timeMemory
1039667slivajanTriangles (CEOI18_tri)C++17
Compilation error
0 ms0 KiB
#include "trilib.h" #include <bits/stdc++.h>using namespace std; typedef long long un;typedef vector<un> vuc;typedef set<un> sun; #define vec vector#define REP(i, a, b) for (un i = (un)a; i < (un)b; i++)#define FEAC(i, a) for (auto&& i : a)#define ALL(x) (x).begin(), (x).end() un N;vuc horni;vuc dolni;vuc cely;vuc obal; map<tuple<un, un, un>, bool> cache; bool is_clockwise_c(un a, un b, un c){ if (cache.count({a, b, c})) return cache[{a, b, c}]; if (cache.count({a, c, b})) return not cache[{a, c, b}]; bool ret = is_clockwise(a, b, c); cache[{a, b, c}] = ret; return ret;} int main(){ N = get_n(); REP(i, 3, N+1){ if (not is_clockwise_c(1, 2, i)) horni.push_back(i); else dolni.push_back(i); } sort(ALL(horni), [](un x, un y){return is_clockwise_c(1, x, y); }); sort(ALL(dolni), [](un x, un y){return is_clockwise_c(1, x, y); }); FEAC(a, horni) cely.push_back(a); cely.push_back(2); FEAC(a, dolni) cely.push_back(a); obal.push_back(1); FEAC(a, cely){ while((obal.size() != 1) and (not is_clockwise_c(obal[obal.size()-2], obal[obal.size()-1], a))){ obal.pop_back(); } obal.push_back(a); } vuc obal_cp = obal; un num = 0; FEAC(a, obal_cp){ while((obal.size() != 1) and (not is_clockwise_c(obal[obal.size()-2], obal[obal.size()-1], a))){ obal.pop_back(); num=0; } obal.push_back(a); num++; if (num == 2) break; } un prvni = obal[obal.size()-2]; un p_idx = 0; while(prvni != obal[p_idx]) p_idx++; give_answer(obal.size() - p_idx - 2);}

Compilation message (stderr)

tri.cpp:1:21: warning: extra tokens at end of #include directive
    1 | #include "trilib.h" #include <bits/stdc++.h>using namespace std; typedef long long un;typedef vector<un> vuc;typedef set<un> sun; #define vec vector#define REP(i, a, b) for (un i = (un)a; i < (un)b; i++)#define FEAC(i, a) for (auto&& i : a)#define ALL(x) (x).begin(), (x).end() un N;vuc horni;vuc dolni;vuc cely;vuc obal; map<tuple<un, un, un>, bool> cache; bool is_clockwise_c(un a, un b, un c){    if (cache.count({a, b, c})) return cache[{a, b, c}];    if (cache.count({a, c, b})) return not cache[{a, c, b}];     bool ret = is_clockwise(a, b, c);    cache[{a, b, c}] = ret;     return ret;} int main(){    N = get_n();     REP(i, 3, N+1){        if (not is_clockwise_c(1, 2, i)) horni.push_back(i);        else dolni.push_back(i);    }      sort(ALL(horni), [](un x, un y){return is_clockwise_c(1, x, y); });    sort(ALL(dolni), [](un x, un y){return is_clockwise_c(1, x, y); });     FEAC(a, horni) cely.push_back(a);    cely.push_back(2);    FEAC(a, dolni) cely.push_back(a);     obal.push_back(1);    FEAC(a, cely){        while((obal.size() != 1) and (not is_clockwise_c(obal[obal.size()-2], obal[obal.size()-1], a))){            obal.pop_back();        }        obal.push_back(a);    }     vuc obal_cp = obal;    un num = 0;     FEAC(a, obal_cp){        while((obal.size() != 1) and (not is_clockwise_c(obal[obal.size()-2], obal[obal.size()-1], a))){            obal.pop_back();            num=0;        }        obal.push_back(a);        num++;        if (num == 2) break;    }     un prvni = obal[obal.size()-2];     un p_idx = 0;    while(prvni != obal[p_idx]) p_idx++;     give_answer(obal.size() - p_idx - 2);}
      |                     ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status