Submission #223638

#TimeUsernameProblemLanguageResultExecution timeMemory
223638Haunted_CppDrvca (COCI19_drvca)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <cstring> #include <algorithm> #pragma GCC optimize ("Ofast") #pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #pragma GCC optimize("unroll-loops") using namespace std; const int N = 2e3; int a [N]; bool vis [N]; int main () { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort (a, a + n); for (int i = 0; i < n; i++) { vector<int> up = {a[0]}, down; if (i) up.emplace_back(a[i]); const int diff = a[i] - a[0]; int nxt = a[i] + (a[i] - a[0]); for (int j = 1; j < n; j++) { if (j == i) continue; if (a[j] == nxt) { up.emplace_back(a[j]); nxt += diff; } else { down.emplace_back(a[j]); } } if ((int) down.size() <= 1) { while ((int) down.size() == 0) { int l = up.back (); up.pop_back (); down.emplace_back(l); } cout << (int) up.size() << '\n'; for (auto to : up) cout << to << ' '; cout << '\n'; cout << (int) down.size() << '\n'; for (auto to : down) cout << to << ' '; cout << '\n'; return 0; } const int d = down[1] - down[0]; for (int j = 1; j < (int) down.size(); j++) { if (down[j] - down[j - 1] != d) { goto fim; } } cout << (int) up.size() << '\n'; for (auto to : up) cout << to << ' '; cout << '\n'; cout << (int) down.size() << '\n'; for (auto to : down) cout << to << ' '; cout << '\n'; return 0; fim:; } cout << -1 << '\n'; return 0; }

Compilation message (stderr)

drvca.cpp: In function 'int main()':
drvca.cpp:26:5: error: 'vector' was not declared in this scope
     vector<int> up = {a[0]}, down;
     ^~~~~~
drvca.cpp:26:5: note: suggested alternative: 'perror'
     vector<int> up = {a[0]}, down;
     ^~~~~~
     perror
drvca.cpp:26:12: error: expected primary-expression before 'int'
     vector<int> up = {a[0]}, down;
            ^~~
drvca.cpp:26:28: error: expected primary-expression before ',' token
     vector<int> up = {a[0]}, down;
                            ^
drvca.cpp:26:30: error: 'down' was not declared in this scope
     vector<int> up = {a[0]}, down;
                              ^~~~
drvca.cpp:27:12: error: 'up' was not declared in this scope
     if (i) up.emplace_back(a[i]);
            ^~
drvca.cpp:33:9: error: 'up' was not declared in this scope
         up.emplace_back(a[j]);
         ^~
drvca.cpp:43:17: error: 'up' was not declared in this scope
         int l = up.back ();
                 ^~
drvca.cpp:47:21: error: 'up' was not declared in this scope
       cout << (int) up.size() << '\n';
                     ^~
drvca.cpp:48:22: error: unable to deduce 'auto&&' from 'up'
       for (auto to : up) cout << to << ' ';
                      ^~
drvca.cpp:51:22: error: unable to deduce 'auto&&' from 'down'
       for (auto to : down) cout << to << ' ';
                      ^~~~
drvca.cpp:63:19: error: 'up' was not declared in this scope
     cout << (int) up.size() << '\n';
                   ^~
drvca.cpp:64:20: error: unable to deduce 'auto&&' from 'up'
     for (auto to : up) cout << to << ' ';
                    ^~
drvca.cpp:67:20: error: unable to deduce 'auto&&' from 'down'
     for (auto to : down) cout << to << ' ';
                    ^~~~