답안 #258885

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
258885 2020-08-06T16:53:06 Z itiam ACM (COCI19_acm) C++11
50 / 50
11 ms 512 KB
#include <bits/stdc++.h>

using namespace std;
#define pb push_back
#define parii pair<int,int>

vector <pair<parii,string>> v;
string nasTim="NijeZivotJedanACM";
int n,m;

int struint(string a){
    int x=0;
    for (auto w: a) x=x*10+w-'0';
    return x;
}

parii racun(){
    int cnt=0, pen=0;
    string zad;
    for (int i=0;i<m;i++){
        cin >> zad;
        if (zad[0]!='-'){
            cnt++;
            pen+=(zad[1]-'0'-1)*1200;
            int h=struint(zad.substr(3,2));
            int m=struint(zad.substr(6,2));
            int sek=struint(zad.substr(9,2));
            pen+=h*3600+m*60+sek;
        }
    }
    return {-cnt, pen};
}

int main(){
    string ime;
    cin >> n >> m;
    for (int i=0;i<n+1;i++){
        cin >> ime;
        auto r=racun();
        if (ime!=nasTim)   v.pb({r,ime});
        else if(i==n)   v.pb({r,ime});
    }
    sort(v.begin(),v.end());
    for (int i=0;i<v.size();i++){    if(v[i].second==nasTim){ cout << i+1;break;}}
    return 0;
}

Compilation message

acm.cpp: In function 'int main()':
acm.cpp:44:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0;i<v.size();i++){    if(v[i].second==nasTim){ cout << i+1;break;}}
                  ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 9 ms 512 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 11 ms 512 KB Output is correct
5 Correct 10 ms 512 KB Output is correct