Submission #667622

#TimeUsernameProblemLanguageResultExecution timeMemory
667622joaofTable Tennis (info1cup20_tabletennis)C++14
72 / 100
3070 ms42248 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, k, v[MAX]; map<int, int> m; bool teste(int a, int b){ int sum = v[a + 1] + v[n + k - b], mark[MAX], qtd = a + b; for(int i = 1; i <= n + k; i++){ m[v[i]]++; mark[i] = 0; if(i <= a || i >= n + k + 1- b) mark[i] = 1; } for(int i = a + 1; i <= n + k - b; i++){ if(m[sum - v[i]] != 0){ m[sum - v[i]]--; } else{ mark[i] = 1; qtd++; } } if(qtd == k){ for(int i = 1; i <= n + k; i++){ if(mark[i]) continue; printf("%d ", v[i]); } return true; } return false; } int main(){ scanf("%d %d", &n, &k); for(int i = 1; i <= n + k; i++){ scanf("%d", &v[i]); } for(int i = 0; i <= k; i++){ for(int j = 0; j <= k - i; j++){ if(teste(i, j)) return 0; } } }

Compilation message (stderr)

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