Submission #852413

#TimeUsernameProblemLanguageResultExecution timeMemory
852413dead0neTenis (COCI20_tenis)C++17
25 / 110
82 ms22352 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]; int sab = wow[seen[ba][0].nd][ab], sba = wow[seen[ab][0].nd][ba]; /*cerr << ab spc sab << endl; cerr << ba spc sba << endl; cerr << seen[ab][0].nd spc seen[ba][0].nd << endl;*/ if(sab < sba){ win[ba]++; //cerr << ba << endl; } else if(sab > sba){ win[ab]++; //cerr << ab << endl; } else if(seen[ab][0].nd < seen[ba][0].nd){ win[ab]++; //cerr << ab spc "woo" << endl; } else{ win[ba]++; //cerr << ba << endl; } //cerr << endl; } } } 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...