답안 #704839

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
704839 2023-03-03T05:15:28 Z browntoad Med (COCI22_med) C++14
50 / 50
133 ms 340 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define RREP(i, n) for (int i=(n)-1; i>=0; i--)
#define pii pair<int, int>
#define psi pair<string, int>
#define f first
#define s second
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())

int n;
bool cmp (psi a, psi b){
    if (a.s == b.s) return a.f<b.f;
    return a.s>b.s;
}
vector<psi> vc;
void inp(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin>>n;
    vc=vector<psi> (n);
    REP(i, n){
        cin>>vc[i].f;
        REP(j, 5){
            int x; cin>>x;
            vc[i].s+=x;
        }
    }
}
void solve(){
    REP(i, n){
        vector<psi> tmp = vc, tmp2 = vc;
        int l, r;
        tmp[i].s+=500;
        tmp2[i].s-=500;
        sort(ALL(tmp), cmp);
        sort(ALL(tmp2), cmp);
        REP(j, n){
            if (vc[i].f == tmp[j].f) l=j+1;
        }
        REP(j, n){
            if(vc[i].f == tmp2[j].f) r=j+1;
        }
        cout<<l<<' '<<r<<endl;

    }
}
signed main(){
    inp();
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 67 ms 340 KB Output is correct
6 Correct 123 ms 328 KB Output is correct
7 Correct 76 ms 340 KB Output is correct
8 Correct 133 ms 340 KB Output is correct
9 Correct 38 ms 340 KB Output is correct