Submission #852421

#TimeUsernameProblemLanguageResultExecution timeMemory
852421dead0neTenis (COCI20_tenis)C++17
55 / 110
88 ms22928 KiB
#pragma GCC optimize("unroll-loops,Ofast,O3") #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define spc << " " << #define endl "\n" #define all(x) x.begin(), x.end() #define ll long long #define int long long #define ii pair<int,int> #define vi vector<int> #define vii vector<ii> #define st first #define nd second #define inf 1000000009 #define MOD 1000000007 using namespace std; void solve(){ int n; cin >> n; vi firs[n+1]; int cour[n+1], win[n+1]; vii seen[n+1]; int ans[4]; int wow[4][n+1]; memset(ans, 0, sizeof(ans)); for(int i=1; i<=n; i++){ win[i]=0; } for(int j=1; j<=3; j++){ for(int i=1; i<=n; i++){ int a; cin >> a; seen[a].pb({i, j}); wow[j][a] = i; } } for(int i=1; i<=n; i++){ sort(all(seen[i])); cour[i] = seen[i][0].nd; firs[seen[i][0].st].pb(i); } /*for(int i=1; i<=n; i++){ cerr << "**" spc i spc "**" << endl; for(auto j:firs[i]) cerr << j << " "; cerr << endl; cerr << cour[i] << endl; }*/ int cur=n; for(int i=1; i<=n; i++){ //cerr << "**" spc i spc "**" << endl; cur-=firs[i].size(); for(auto j:firs[i]) win[j]+=cur; for(int j=0; j<firs[i].size(); j++){ for(int k=j+1; k<firs[i].size(); k++){ int ab = firs[i][j], ba = firs[i][k]; vii hehe; for(int gu=1; gu<=3; gu++){ if(wow[gu][ab]==i){ hehe.pb({wow[gu][ba], gu}); } else if(wow[gu][ba]==i){ hehe.pb({wow[gu][ab], gu}); } } sort(all(hehe)); if(wow[hehe[0].nd][ab]==i){ win[ab]++; } else if(wow[hehe[0].nd][ba]==i){ win[ba]++; } } } } for(int i=1; i<=n; i++) ans[cour[i]]+=win[i]; cout << ans[1] spc ans[2] spc ans[3] << endl; for(int i=1; i<=n; i++) cout << win[i] << " "; } signed main(){ ios_base::sync_with_stdio(false);cin.tie(0); #ifdef Local freopen("in","r",stdin); freopen("out","w",stdout); #endif ll t=1; //cin >> t; while(t--) solve(); }

Compilation message (stderr)

tenis.cpp: In function 'void solve()':
tenis.cpp:65:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |         for(int j=0; j<firs[i].size(); j++){
      |                      ~^~~~~~~~~~~~~~~
tenis.cpp:66:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |             for(int k=j+1; k<firs[i].size(); k++){
      |                            ~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...