답안 #576348

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
576348 2022-06-13T04:14:55 Z AGE ACM (COCI19_acm) C++14
50 / 50
26 ms 31872 KB
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back

using namespace std;
const int N=1e6,M=3e3+2,mod=1e9+7;
int a[N];
string ss[N];
int num[N],ans[N];
main()
{



    int n,m;
    cin>>n>>m;
    int index;
    for(int i=0; i<n; i++)
    {
        cin>>ss[i];


        for(int j=0; j<m; j++)
        {
            string s;
            cin>>s;

            if(ss[i]=="NijeZivotJedanACM"){
                index=i;
                continue;
            }

            if(s[0]=='-')
            {

                continue;

            }

            else
            {

                num[i]++;
                ans[i]+=1200*(s[1]-'0');
                ans[i]+=(s[4]-'0')*3600;
                int x=s[6]-'0';
                x*=10;
                x+=(s[7]-'0');
                ans[i]+=x*60;

                x=s[9]-'0';
                x*=10;
                x+=(s[10]-'0');
                ans[i]+=x;

            }
        }
        num[i]=-num[i];

    }

    string sss;
    cin>>sss;

    for(int j=0; j<m; j++)
    {
        string s;
        cin>>s;


        if(s[0]=='-'||s[0]=='?')
        {

            continue;

        }

        else
        {


            num[index]++;
            ans[index]+=1200*(s[1]-'0');
            ans[index]+=(s[4]-'0')*3600;
            int x=s[6]-'0';
            x*=10;
            x+=(s[7]-'0');
            ans[index]+=x*60;

            x=s[9]-'0';
            x*=10;
            x+=(s[10]-'0');
            ans[index]+=x;

        }
    }
        num[index]=-num[index];

    int ansindex;
    vector< pair< int, pair<int,string > > >v;

    for(int i=0; i<n; i++){
        v.pb({num[i],{ans[i],ss[i]}});
    }

    sort(v.begin(),v.end());

    for(int i=0; i<v.size(); i++)
    {
        if(v[i].S.S=="NijeZivotJedanACM")
            ansindex=i;

    }

    cout<<ansindex+1<<endl;

    return 0;

}

Compilation message

acm.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main()
      | ^~~~
acm.cpp: In function 'int main()':
acm.cpp:110:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, std::__cxx11::basic_string<char> > > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  110 |     for(int i=0; i<v.size(); i++)
      |                  ~^~~~~~~~~
acm.cpp:117:20: warning: 'ansindex' may be used uninitialized in this function [-Wmaybe-uninitialized]
  117 |     cout<<ansindex+1<<endl;
      |                    ^
acm.cpp:99:30: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]
   99 |         num[index]=-num[index];
      |                     ~~~~~~~~~^
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 31700 KB Output is correct
2 Correct 20 ms 31832 KB Output is correct
3 Correct 18 ms 31628 KB Output is correct
4 Correct 26 ms 31828 KB Output is correct
5 Correct 24 ms 31872 KB Output is correct