제출 #142709

#제출 시각아이디문제언어결과실행 시간메모리
142709HellAngelGap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
long long findGap(int T, int N)
{
    int ans = 0;
    if(T == 1)
    {
        int mx, my;
        vector<int> vt = {};
        int l = 0;
        int r = LLONG_MAX;
        while(true)
        {
            MinMax(l, r, &mx, &my);
            if(mx == my)
            {
                vt.push_back(mx);
                break;
            }
            if(mx == -1)
            {
                break;
            }
            vt.push_back(mx);
            vt.push_back(my);
            l = mx + 1;
            r = my - 1;
        }
        sort(vt.begin(), vt.end());
        for(int i = 1; i < (int)vt.size(); i++)
        {
            ans = max(ans, vt[i] - vt[i - 1]);
        }
    }
	return ans;
}

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:7:9: error: 'vector' was not declared in this scope
         vector<int> vt = {};
         ^~~~~~
gap.cpp:7:16: error: expected primary-expression before 'int'
         vector<int> vt = {};
                ^~~
gap.cpp:9:17: error: 'LLONG_MAX' was not declared in this scope
         int r = LLONG_MAX;
                 ^~~~~~~~~
gap.cpp:9:17: note: suggested alternative: '__LONG_MAX__'
         int r = LLONG_MAX;
                 ^~~~~~~~~
                 __LONG_MAX__
gap.cpp:12:13: error: 'MinMax' was not declared in this scope
             MinMax(l, r, &mx, &my);
             ^~~~~~
gap.cpp:15:17: error: 'vt' was not declared in this scope
                 vt.push_back(mx);
                 ^~
gap.cpp:22:13: error: 'vt' was not declared in this scope
             vt.push_back(mx);
             ^~
gap.cpp:27:14: error: 'vt' was not declared in this scope
         sort(vt.begin(), vt.end());
              ^~
gap.cpp:27:9: error: 'sort' was not declared in this scope
         sort(vt.begin(), vt.end());
         ^~~~
gap.cpp:27:9: note: suggested alternative: 'short'
         sort(vt.begin(), vt.end());
         ^~~~
         short
gap.cpp:30:19: error: 'max' was not declared in this scope
             ans = max(ans, vt[i] - vt[i - 1]);
                   ^~~
gap.cpp:30:19: note: suggested alternative: 'mx'
             ans = max(ans, vt[i] - vt[i - 1]);
                   ^~~
                   mx