# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
852413 |
2023-09-21T19:07:40 Z |
dead0ne |
Tenis (COCI20_tenis) |
C++17 |
|
82 ms |
22352 KB |
#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
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 time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
600 KB |
Output is correct |
3 |
Partially correct |
0 ms |
344 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
600 KB |
Output is correct |
3 |
Partially correct |
0 ms |
344 KB |
Partially correct |
4 |
Correct |
2 ms |
1112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
600 KB |
Output is correct |
3 |
Partially correct |
0 ms |
344 KB |
Partially correct |
4 |
Correct |
2 ms |
1112 KB |
Output is correct |
5 |
Partially correct |
24 ms |
9040 KB |
Partially correct |
6 |
Correct |
40 ms |
13444 KB |
Output is correct |
7 |
Partially correct |
67 ms |
18000 KB |
Partially correct |
8 |
Partially correct |
82 ms |
22352 KB |
Partially correct |
9 |
Incorrect |
65 ms |
21588 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |