제출 #691817

#제출 시각아이디문제언어결과실행 시간메모리
691817LextyleTable Tennis (info1cup20_tabletennis)C++17
100 / 100
153 ms4420 KiB
#include <bits/stdc++.h> #pragma warning(disable : 4996) #pragma warning(disable : 6031) #define USACO freopen("moocast.in", "r", stdin); freopen("moocast.out", "w+", stdout) #define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define ll long long using namespace std; ll binpow(ll a, ll x, ll m) { ll ans = 1, md = a % m; for (int i = 0; i < 63; i++) { if (x & ((ll)1 << i)) ans = (ans * md) % m; md = (md * md) % m; } return ans; } vector<ll> gcd(ll a, ll b) { if (b == 0) { return { a, 1, 0 }; } vector<ll> d = gcd(b, a % b); return { d[0], d[2], d[1] - d[2] * (a / b) }; } ll lcm(ll a, ll b) { return a * b / gcd(a, b)[0]; } int a[200000], ans[150000]; void solve() { int n, k; cin >> k >> n; n += k; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { for (int j = i + k - 1; j < n; j++) { int cnt = 0; for (int l = i, r = j; 2 * cnt < k; l++) { while (r > l && a[j] - a[r] < a[l] - a[i]) r--; if (r <= l) break; if (r - l + 1 < k - 2 * cnt) break; if (a[j] - a[r] == a[l] - a[i]) { ans[cnt] = a[l]; ans[k - 1 - cnt] = a[r]; cnt++; r--; } } if (2 * cnt == k) { for (int c = 0; c < k; c++) cout << ans[c] << " "; return; } } } } int main() { //USACO; fastIO; solve(); }

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

tabletennis.cpp:2: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
    2 | #pragma warning(disable : 4996)
      | 
tabletennis.cpp:3: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
    3 | #pragma warning(disable : 6031)
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...