제출 #229773

#제출 시각아이디문제언어결과실행 시간메모리
229773Ruxandra985Triangles (CEOI18_tri)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

long long v[40010] , x[40010] , y[40010] , s[40010];

int cmp (int x , int y){

    return !is_clockwise(1 , x , y);

}
int main()
{
    long long n , i , elem , j;
    n = get_n();

    /// stergi citirea, folosesti get_n

    for (i = 1 ; i <= n ; i++)
        v[i] = i;

    sort (v + 2 , v + n + 1 , cmp);

    /*for (i = 1 ; i <= n ; i++){
        fprintf (fout,"%d\n" , v[i]);
    }*/

    v[n + 1] = 1;
    s[1] = v[1];
    s[2] = v[2];
    elem = 2;
    for (j = 3 ; j <= n ; j++){
        while (elem >= 2 && is_clockwise (s[elem - 1] , s[elem] , v[j]))
            elem--;
        s[++elem] = v[j];
    }


    while (elem >= 2 && is_clockwise (s[elem - 1] , s[elem] , s[1]))
        elem--;

    while (elem >= 2 && is_clockwise (s[elem] , s[1] , s[2]))
        elem--;

    elem = max(elem , 3LL);

   give_answer((int)elem);


    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

tri.cpp: In function 'int cmp(int, int)':
tri.cpp:9:13: error: 'is_clockwise' was not declared in this scope
     return !is_clockwise(1 , x , y);
             ^~~~~~~~~~~~
tri.cpp:9:13: note: suggested alternative: 'funlockfile'
     return !is_clockwise(1 , x , y);
             ^~~~~~~~~~~~
             funlockfile
tri.cpp: In function 'int main()':
tri.cpp:15:9: error: 'get_n' was not declared in this scope
     n = get_n();
         ^~~~~
tri.cpp:15:9: note: suggested alternative: 'getwc'
     n = get_n();
         ^~~~~
         getwc
tri.cpp:33:29: error: 'is_clockwise' was not declared in this scope
         while (elem >= 2 && is_clockwise (s[elem - 1] , s[elem] , v[j]))
                             ^~~~~~~~~~~~
tri.cpp:33:29: note: suggested alternative: 'funlockfile'
         while (elem >= 2 && is_clockwise (s[elem - 1] , s[elem] , v[j]))
                             ^~~~~~~~~~~~
                             funlockfile
tri.cpp:39:25: error: 'is_clockwise' was not declared in this scope
     while (elem >= 2 && is_clockwise (s[elem - 1] , s[elem] , s[1]))
                         ^~~~~~~~~~~~
tri.cpp:39:25: note: suggested alternative: 'funlockfile'
     while (elem >= 2 && is_clockwise (s[elem - 1] , s[elem] , s[1]))
                         ^~~~~~~~~~~~
                         funlockfile
tri.cpp:42:25: error: 'is_clockwise' was not declared in this scope
     while (elem >= 2 && is_clockwise (s[elem] , s[1] , s[2]))
                         ^~~~~~~~~~~~
tri.cpp:42:25: note: suggested alternative: 'funlockfile'
     while (elem >= 2 && is_clockwise (s[elem] , s[1] , s[2]))
                         ^~~~~~~~~~~~
                         funlockfile
tri.cpp:47:4: error: 'give_answer' was not declared in this scope
    give_answer((int)elem);
    ^~~~~~~~~~~