# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
328676 |
2020-11-17T15:16:19 Z |
SorahISA |
Tenis (COCI20_tenis) |
C++17 |
|
1 ms |
364 KB |
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;
#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back
#define fastIO() ios_base::sync_with_stdio(false), cin.tie(0)
const int maxn = 1E5 + 5;
int32_t main() {
fastIO();
int n;
cin >> n;
vector<int> fight(3), win(n), court[3];
court[0].resize(n); for (auto &x : court[0]) cin >> x;
court[1].resize(n); for (auto &x : court[1]) cin >> x;
court[2].resize(n); for (auto &x : court[2]) cin >> x;
for (int i = 0; i < n; ++i) {
for (int j = i+1; j < n; ++j) {
int mna = min(court[0][i], court[0][j]), mxa = max(court[0][i], court[0][j]),
mnb = min(court[1][i], court[1][j]), mxb = max(court[1][i], court[1][j]),
mnc = min(court[2][i], court[2][j]), mxc = max(court[2][i], court[2][j]);
int pl = -1;
if (mna < mnb and mna < mnc) pl = 0;
else if (mnb < mna and mnb < mnc) pl = 1;
else if (mnc < mna and mnc < mnb) pl = 2;
else if (mna <= mnb and mna <= mnc and mxa <= mxb and mxa <= mxc) pl = 0;
else if (mnb <= mna and mnb <= mnc and mxb < mxa and mxb <= mxc) pl = 1;
else if (mnc <= mna and mnc <= mnb and mxc < mxa and mxc < mxb) pl = 2;
// printf("Matches (%lld,%lld) played on court %lld and win by %lld.\n", i, j, pl, court[pl][i] < court[pl][j] ? i : j);
++fight[pl];
court[pl][i] < court[pl][j] ? ++win[i] : ++win[j];
}
}
for (auto x : fight) cout << x << " "; cout << "\n";
for (auto x : win) cout << x << " "; cout << "\n";
return 0;
}
Compilation message
tenis.cpp: In function 'int32_t main()':
tenis.cpp:52:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
52 | for (auto x : fight) cout << x << " "; cout << "\n";
| ^~~
tenis.cpp:52:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
52 | for (auto x : fight) cout << x << " "; cout << "\n";
| ^~~~
tenis.cpp:53:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
53 | for (auto x : win) cout << x << " "; cout << "\n";
| ^~~
tenis.cpp:53:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
53 | for (auto x : win) cout << x << " "; cout << "\n";
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
364 KB |
Partially correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
364 KB |
Partially correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
364 KB |
Partially correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |