# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
884229 |
2023-12-06T21:06:44 Z |
tsumondai |
Med (COCI22_med) |
C++14 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
#define __TIME (1.0 * clock() / CLOCKS_PER_SEC)
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 500 + 5;
const int oo = 1e9, mod = 1e9 + 7;
int n;
ii ans[N];
ii coms[N];
map<int, string> dick;
void process() {
cin >> n;
foru(i, 1, n) {
string s; int sum = 0;
cin >> s;
foru(i, 1, 5) {
int x; cin >> x; sum += x;
}
//cout << sum << '\n';
coms[i] = {sum, i};
dick[i]=s;
}
sort(coms + 1, coms + 1 + n, greater<ii>());
foru(i, 1, n) {
int cur = i;
int l = i, r = i;
while (abs(coms[cur].fi - coms[i].fi) <= 500 && dick[coms[i].se] <= dick[coms[cur].se] && cur>=1) cur--;
l = cur + 1;
cur = i;
while (abs(coms[cur].fi - coms[i].fi) <= 500 && dick[coms[i].se] >= dick[coms[cur].se] && cur<=n) cur++;
r = cur - 1;
ans[coms[i].se] = {l, r};
}
foru(i, 1, n) cout << ans[i].fi << ' ' << ans[i].se << '\n';
return;
}
signed main() {
cin.tie(0)->sync_with_stdio(false);
//freopen(".inp", "r", stdin);
//freopen(".out", "w", stdout);
process();
cerr << "Time elapsed: " << __TIME << " s.\n";
return 0;
}
// dont stop
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |