답안 #852420

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
852420 2023-09-21T19:14:57 Z dead0ne Tenis (COCI20_tenis) C++17
0 / 110
0 ms 344 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];
                vii hehe;
                for(int gu=1; gu<=3; gu++){
                    if(wow[gu][ab]==i){
                        hehe.pb({wow[gu][ba], gu});
                    }
                    else{
                        hehe.pb({wow[gu][ab], gu});
                    }
                }
                sort(all(hehe));
                if(wow[hehe[0].nd][ab]==i){
                    win[ab]++;
                }
                else{
                    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

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++){
      |                            ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -