제출 #1253744

#제출 시각아이디문제언어결과실행 시간메모리
1253744terracottaliteACM (COCI19_acm)C++20
50 / 50
3 ms1060 KiB
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);

    pair<pair<int, int>, string> a[1005];

    string tmp;
    int h = -1;
    for (int i=0;i<n+1;i++) {
        int x = i;
        if (i == n) x = h;
        cin >> a[x].second;
        int solved = 0;
        int penalty = 0;
        for (int j=0;j<m;j++) {
            cin >> tmp;
            int th = 0;
            if (tmp[0] == '+') th++;
            if (tmp[0] == '?' && i != n) th++;
            if (th) {
                penalty += (tmp[1]-'0'-1)*20*60;
                penalty += (tmp[4])*60*60;
                penalty += (tmp[6]*10 + tmp[7])*60;
                penalty += (tmp[8]*10 + tmp[9]);
                solved++;
            }
        }
        if (a[i].second == "NijeZivotJedanACM" && i != n) {
            h = i;
            continue;
        }
        a[x].first.second = penalty;
        a[x].first.first = -solved;
    }

    //printf("%d %d %d\n", a[0].first, a[1].first, a[2].first);

    sort(a, a+n);

    //printf("%d %d %d %d\n", a[0].first, a[1].first, a[2].first, a[3].first);

    //cout << a[0].second << a[1].second << a[2].second << a[3].second;

    int ans = -1;

    for (int i=0;i<n;i++) {
        if (a[i].second == "NijeZivotJedanACM") ans = i+1;
    }

    printf("%d\n", ans);
 }

컴파일 시 표준 에러 (stderr) 메시지

acm.cpp: In function 'int main()':
acm.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...