Submission #667584

#TimeUsernameProblemLanguageResultExecution timeMemory
667584joaofTable Tennis (info1cup20_tabletennis)C++14
20 / 100
163 ms23468 KiB
#include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define all(x) x.begin(), x.end() #define bug(x) cerr << #x << ": " << x << endl using namespace std; using ll = long long; const int MAX = 15e4 + 10; int n, v[MAX], sum, k; map<int, int> m; bool fake[MAX]; void sol1(){ int qtd = 0, err = 0; sum = v[1] + v[n + k]; for(int i = 1; i <= n + k; i++){ if(m[sum - v[i]] != 0){ m[sum - v[i]]--; } else{ qtd++; if(qtd == 1) err = i; } } if(qtd == 1){ for(int i = 1; i <= n + k; i++){ if(i != err){ printf("%d ", v[i]); } } } for(int i = 1; i <= n + k; i++){ m[v[i]]++; } qtd = 0, err = 0; sum = v[2] + v[n + k]; for(int i = 1; i <= n + k; i++){ if(m[sum - v[i]] != 0){ m[sum - v[i]]--; } else{ qtd++; if(qtd == 1) err = i; } } if(qtd == 1){ for(int i = 1; i <= n + k; i++){ if(i != err){ printf("%d ", v[i]); } } } for(int i = 1; i <= n + k; i++){ m[v[i]]++; } qtd = 0, err = 0; sum = v[1] + v[n + k - 1]; for(int i = 1; i <= n + k; i++){ if(m[sum - v[i]] != 0){ m[sum - v[i]]--; } else{ qtd++; if(qtd == 1) err = i; } } if(qtd == 1){ for(int i = 1; i <= n + k; i++){ if(i != err){ printf("%d ", v[i]); } } } } int main(){ scanf("%d %d", &n, &k); for(int i = 1; i <= n + k; i++){ scanf("%d", &v[i]); m[v[i]]++; } if(k == 1){ sol1(); } }

Compilation message (stderr)

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:92:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   92 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
tabletennis.cpp:95:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   95 |         scanf("%d", &v[i]);
      |         ~~~~~^~~~~~~~~~~~~
#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...