Submission #698475

# Submission time Handle Problem Language Result Execution time Memory
698475 2023-02-13T15:23:08 Z Do_you_copy Tenis (COCI20_tenis) C++17
50 / 110
148 ms 1944 KB
//Then
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define faster ios_base::sync_with_stdio(0); cin.tie(0);

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair <int, int>;
mt19937_64 Rand(chrono::steady_clock::now().time_since_epoch().count());
const int maxN = 1e5 + 1;
//const int Mod = 1e9 + 7;
//const int inf =
int n;
int a[maxN], b[maxN], c[maxN];
int id[maxN][3];

struct T{
    int i, j, k;
    bool operator < (const T &other) const{
        if (id[i][k] == id[other.i][other.k]){
            if (id[j][k] == id[other.j][other.k]) return k < other.k;
            return id[j][k] < id[other.j][other.k];
        }
        return id[i][k] < id[other.i][other.k];
    }
};

int ans[3];
int cnt[maxN];
void Sub12(){
    for (int i = 1; i <= n; ++i){
        for (int j = i + 1; j <= n; ++j){
            T t[3];
            for (int k = 0; k < 3; ++k){
                if (id[i][k] < id[j][k]){
                    t[k] = {i, j, k};
                }
                else t[k] = {j, i, k};
            }
            sort(t, t + 3);
            ++cnt[t[0].i];
            ++ans[t[0].k];
        }
    }
    cout << ans[0] << " " << ans[1] << " " << ans[2] << "\n";
    for (int i = 1; i <= n; ++i) cout << cnt[i] << " ";
}

void Sub3(){

}


void Init(){
    cin >> n;
    for (int i = 1; i <= n; ++i){
        cin >> a[i];
        id[a[i]][0] = i;
    }
    for (int i = 1; i <= n; ++i){
        cin >> b[i];
        id[b[i]][1] = i;
    }
    for (int i = 1; i <= n; ++i){
        cin >> c[i];
        id[c[i]][2] = i;
    }
    if (n <= 3000) Sub12();
    else Sub3();
}

#define debug
#define taskname "tenis"
signed main(){
    faster
    if (fopen(taskname".inp", "r")){
        freopen(taskname".inp", "r", stdin);
        freopen(taskname".out", "w", stdout);
    }
    int tt = 1;
    //cin >> tt;
    while (tt--){
        Init();
    }
    if (fopen("timeout.txt", "r")){
        ofstream timeout("timeout.txt");
        timeout << signed(double(clock()) / CLOCKS_PER_SEC * 1000);
        timeout.close();
        #ifndef debug
        cerr << "Time elapsed: " << signed(double(clock()) / CLOCKS_PER_SEC * 1000) << "ms\n";
        #endif // debug
    }
}

Compilation message

tenis.cpp: In function 'int main()':
tenis.cpp:80:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   80 |         freopen(taskname".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
tenis.cpp:81:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   81 |         freopen(taskname".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 148 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 148 ms 468 KB Output is correct
5 Incorrect 15 ms 1944 KB Output isn't correct
6 Halted 0 ms 0 KB -