제출 #691821

#제출 시각아이디문제언어결과실행 시간메모리
691821VahanAbrahamTable Tennis (info1cup20_tabletennis)C++14
20 / 100
108 ms7656 KiB
#include <iostream> #include <string> #include <algorithm> #include <cstring> #include <cstdio> #include <sstream> #include <map> #include <stack> #include <set> #include <queue> #include <unordered_set> #include <unordered_map> #include <math.h> #include <cmath> #include <vector> using namespace std; #define ll long long #define fr first #define sc second #define pb push_back #define US freopen("hps.in", "r", stdin); freopen("hps.out", "w", stdout); ll gcd(ll a, ll b) { if (a == 0 || b == 0) { return max(a, b); } if (a <= b) { return gcd(a, b % a); } else { return gcd(a % b, b); } } ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } int isprime(int p) { if (p <= 1) { return 0; } for (int i = 2; i * i <= p; i++) { if (p % i == 0) { return 0; } } return 1; } const int N = 200005; pair<ll, ll> p[N], ps[N]; vector <int> g[N]; ll a[N]; void solve() { int n, k; cin >> n >> k; int h = n + k; for (int i = 0;i < h;i++) { cin >> a[i]; } sort(a, a + h); bool fl = true; int z = 0; int l = 0, r = 0; ll x = 0; for (int i = 0;i < h;i++) { l = 0, r = h - 1; x = -1; bool fl = true; while (l < r) { if (l == i) { l++; } if (r == i) { r--; } if (x != a[r] + a[l] && x != -1) { fl = false; break; } else { if (x == -1) { x = a[r] + a[l]; } } l++; r--; } if (fl == 1) { for (int j = 0;j < h;j++) { if (i != j) { cout << a[j] << " "; } } return; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //US int tt = 1; //cin >> tt; while (tt--) { solve(); } } /* %% %% % %% %% % %% %% %% %% %% %% %% %% %% %% %%%% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %%%%%%%%% %%%%%%%%%% %%%%%%%%% %% %% %% %% %% %% %% %% %% %% %% %% %%%% %% %% %% %% %% %% %% %% %% %%% % %% %% %% %% %% %% %% %% */

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

tabletennis.cpp: In function 'void solve()':
tabletennis.cpp:73:10: warning: unused variable 'fl' [-Wunused-variable]
   73 |     bool fl = true;
      |          ^~
tabletennis.cpp:74:9: warning: unused variable 'z' [-Wunused-variable]
   74 |     int z = 0;
      |         ^
#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...