# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
447525 | 2021-07-26T16:14:12 Z | LucaIlie | Table Tennis (info1cup20_tabletennis) | C++17 | 98 ms | 6876 KB |
#include <stdio.h> #include <algorithm> #include <map> #define MAX_N 150000 #define MAX_K 400 int v[MAX_N + MAX_K], sume[(2 * MAX_K + 1) * (2 * MAX_K + 1)], ans[MAX_N]; int main() { int n, k, m, suma, apMax, s, f, i, j; scanf( "%d%d", &n, &k ); for ( i = 0; i < n + k; i++ ) scanf( "%d", &v[i] ); m = 0; for ( i = 0; i < 2 * k + 1 && i < n + k; i++ ) { for ( j = n + k - (2 * k + 1) > 0 ? n + k - (2 * k + 1) : 0; j < n + k; j++ ) { if ( i != j ) { sume[m] = v[i] + v[j]; m++; } } } std::sort( sume, sume + m ); suma = -1; apMax = 0; i = 0; while ( i < m ) { j = i + 1; while ( j < m && sume[i] == sume[j] ) j++; if ( j - i > apMax ) { apMax = j - i; suma = sume[i]; } i = j; } s = 0; f = n + k - 1; i = 0; while ( s < f && i < n / 2 ) { if ( v[s] + v[f] == suma ) { ans[i] = v[s]; ans[n - 1 - i] = v[f]; s++; f--; i++; } else if ( v[s] + v[f] < suma ) s++; else f--; } if ( apMax > 0 ) { for ( i = 0; i < n; i++ ) printf( "%d ", ans[i] ); } else printf( "%d ", 0 ); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 716 KB | Output is correct |
2 | Correct | 40 ms | 2944 KB | Output is correct |
3 | Correct | 38 ms | 3012 KB | Output is correct |
4 | Correct | 38 ms | 2936 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 2908 KB | Output is correct |
2 | Correct | 41 ms | 2996 KB | Output is correct |
3 | Incorrect | 35 ms | 1464 KB | Output not sorted |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 3 ms | 332 KB | Output is correct |
3 | Correct | 3 ms | 448 KB | Output is correct |
4 | Correct | 3 ms | 460 KB | Output is correct |
5 | Correct | 3 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 332 KB | Output not sorted |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 39 ms | 2980 KB | Output is correct |
3 | Correct | 38 ms | 2928 KB | Output is correct |
4 | Correct | 41 ms | 2956 KB | Output is correct |
5 | Correct | 38 ms | 3024 KB | Output is correct |
6 | Correct | 40 ms | 3080 KB | Output is correct |
7 | Correct | 48 ms | 2948 KB | Output is correct |
8 | Correct | 38 ms | 3012 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 1020 KB | Output is correct |
2 | Correct | 90 ms | 5492 KB | Output is correct |
3 | Correct | 86 ms | 6852 KB | Output is correct |
4 | Correct | 98 ms | 6804 KB | Output is correct |
5 | Correct | 67 ms | 6700 KB | Output is correct |
6 | Correct | 65 ms | 6876 KB | Output is correct |
7 | Correct | 85 ms | 6748 KB | Output is correct |
8 | Correct | 95 ms | 6816 KB | Output is correct |