# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
199588 | 2020-02-02T05:54:54 Z | SamAnd | Drvca (COCI19_drvca) | C++17 | 50 ms | 3316 KB |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n; int a[N]; void stg(const vector<int>& v1, const vector<int>& v2) { if (v1.empty()) return; if (v2.empty()) return; for (int i = 0; i < v1.size() - 1; ++i) { if (v1[i + 1] - v1[i] != v1[1] - v1[0]) return; } for (int i = 0; i < v2.size() - 1; ++i) { if (v2[i + 1] - v2[i] != v2[1] - v2[0]) return; } printf("%d\n", v1.size()); for (int i = 0; i < v1.size(); ++i) printf("%d ", v1[i]); printf("\n"); printf("%d\n", v2.size()); for (int i = 0; i < v2.size(); ++i) printf("%d ", v2[i]); printf("\n"); exit(0); } int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) scanf("%d", &a[i]); sort(a + 1, a + n + 1); vector<int> v1, v2; v1.push_back(a[1]); v1.push_back(a[2]); for (int i = 3; i <= n; ++i) { if (a[i] - v1.back() == a[2] - a[1]) v1.push_back(a[i]); else v2.push_back(a[i]); } stg(v1, v2); v1.clear(); v2.clear(); v1.push_back(a[1]); v2.push_back(a[2]); if (n == 2) stg(v1, v2); v1.push_back(a[3]); for (int i = 4; i <= n; ++i) { if (a[i] - v1.back() == a[3] - a[1]) v1.push_back(a[i]); else v2.push_back(a[i]); } stg(v1, v2); v1.clear(); v2.clear(); v1.push_back(a[1]); v2.push_back(a[2]); v2.push_back(a[3]); for (int i = 4; i <= n; ++i) { if (a[i] - v2.back() == a[3] - a[2]) v2.push_back(a[i]); else v1.push_back(a[i]); } stg(v1, v2); printf("-1\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 380 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 6 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 5 ms | 256 KB | Output is correct |
9 | Incorrect | 6 ms | 256 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 380 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 6 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 5 ms | 256 KB | Output is correct |
9 | Incorrect | 6 ms | 256 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 46 ms | 3316 KB | Output is correct |
2 | Correct | 46 ms | 3188 KB | Output is correct |
3 | Correct | 48 ms | 3316 KB | Output is correct |
4 | Correct | 44 ms | 3188 KB | Output is correct |
5 | Correct | 44 ms | 3316 KB | Output is correct |
6 | Correct | 47 ms | 3184 KB | Output is correct |
7 | Correct | 46 ms | 3292 KB | Output is correct |
8 | Correct | 50 ms | 3188 KB | Output is correct |
9 | Incorrect | 32 ms | 2220 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 380 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 6 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 5 ms | 256 KB | Output is correct |
9 | Incorrect | 6 ms | 256 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |