Submission #704846

# Submission time Handle Problem Language Result Execution time Memory
704846 2023-03-03T05:29:43 Z PixelCat Med (COCI22_med) C++14
50 / 50
1 ms 340 KB
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
#define int LL
using namespace std;
using LL = long long;
using pii = pair<int, int>;

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // nya ><
    int n; cin >> n;
    vector<pair<int, string>> v(n);
    for(auto &i:v) {
        string s; cin >> s;
        int tot = 0;
        For(_, 1, 5) {
            int x; cin >> x;
            tot += x;
        }
        i = make_pair(-tot, s);
    }
    vector<pair<int, string>> rk(all(v));
    sort(all(rk));
    // vector<int> l(n), r(n);
    For(i, 0, n - 1) {
        auto p = v[i];
        p.F -= 500;
        cout << (lower_bound(all(rk), p) - rk.begin() + 1) << " ";
        p.F += 1000;
        cout << (lower_bound(all(rk), p) - rk.begin()) << "\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct