Submission #698475

#TimeUsernameProblemLanguageResultExecution timeMemory
698475Do_you_copyTenis (COCI20_tenis)C++17
50 / 110
148 ms1944 KiB
//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)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...