# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
447537 | 2021-07-26T16:57:02 Z | LucaIlie | Table Tennis (info1cup20_tabletennis) | C++17 | 50 ms | 2944 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, s, f, i, j, l; 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 ); i = 0; l = 0; while ( i < m ) { j = i + 1; while ( j < m && sume[i] == sume[j] ) j++; if ( j - i > k ) { suma = sume[i]; s = 0; f = n + k - 1; l = 0; while ( s < f && l < n / 2 ) { if ( v[s] + v[f] == suma ) { ans[l] = v[s]; ans[n - 1 - l] = v[f]; s++; f--; l++; } else if ( v[s] + v[f] < suma ) s++; else f--; } if ( l == n / 2 ) break; } i = j; } if ( l == n / 2 ) for ( i = 0; i < n; i++ ) printf( "%d ", ans[i] ); else printf( "."); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 2 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 588 KB | Output is correct |
2 | Correct | 41 ms | 2944 KB | Output is correct |
3 | Correct | 38 ms | 2804 KB | Output is correct |
4 | Correct | 40 ms | 2884 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 2828 KB | Output is correct |
2 | Correct | 38 ms | 2864 KB | Output is correct |
3 | Correct | 38 ms | 2828 KB | Output is correct |
4 | Correct | 37 ms | 2848 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Expected integer, but "." found |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Expected integer, but "." found |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Expected integer, but "." found |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Expected integer, but "." found |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 972 KB | Expected integer, but "." found |
2 | Halted | 0 ms | 0 KB | - |