Submission #685893

#TimeUsernameProblemLanguageResultExecution timeMemory
685893Alihan_8Table Tennis (info1cup20_tabletennis)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> // include <ext/pb_ds/assoc_container.hpp> // include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; #define all(x) x.begin(), x.end() #define pb push_back // define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> #define mpr make pair #define ln '\n' void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);} #define int long long signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; vector <int> p(n+k); for ( auto &i: p ) cin >> i; int cnt = accumulate(all(p), 0ll); map <int,int> mp; for ( auto i: p ) mp[i]++; int res = -1; for ( int i = 0; i < n+k; i++ ){ mp[p[i]]--; int cur = (cnt-p[i]), team = n/2; if ( cur%team ) continue; bool flag = true; for ( int j = 0; j < n+k; j++ ){ if ( i == j ) continue; int val = cur/team-p[j]; if ( !mp.count(val) ){ flag = false; break; } if ( --mp[val] == 0 ) mp.erase(val); } if ( flag ) res = i+1; mp.clear(); for ( auto j: p ) mp[j]++; } for ( int i = 1; i <= n+k; i++ ){ if ( i != res ) cout << i << ' ';4 } cout << '\n'; }

Compilation message (stderr)

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:43:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   43 |         if ( i != res ) cout << i << ' ';4
      |         ^~
tabletennis.cpp:43:42: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   43 |         if ( i != res ) cout << i << ' ';4
      |                                          ^
tabletennis.cpp:43:43: error: expected ';' before '}' token
   43 |         if ( i != res ) cout << i << ' ';4
      |                                           ^
      |                                           ;
   44 |     }
      |     ~                                      
tabletennis.cpp:43:42: warning: statement has no effect [-Wunused-value]
   43 |         if ( i != res ) cout << i << ' ';4
      |                                          ^
tabletennis.cpp: In function 'void IO(std::string)':
tabletennis.cpp:11:29: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tabletennis.cpp:11:70: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                                                               ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~