# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
698475 | Do_you_copy | Tenis (COCI20_tenis) | C++17 | 148 ms | 1944 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |