Submission #339651

#TimeUsernameProblemLanguageResultExecution timeMemory
339651HazemACM (COCI19_acm)C++14
50 / 50
7 ms492 KiB
/* ID: tmhazem1 LANG: C++14 TASK: pprime */ #include <bits/stdc++.h> using namespace std; #define S second #define F first #define LL long long const int N = 1e3 + 10; LL LINF = 100000000000000000; LL INF = 1000000000; vector<pair<pair<int,int>,string>>vec; bool cmp(pair<pair<int,int>,string>p,pair<pair<int,int>,string>p1){ if(p.F.F!=p1.F.F)return p.F.F>p1.F.F; if(p.F.S!=p1.F.S)return p.F.S<p1.F.S; return p.S<p1.S; } int main() { //freopen("out.txt","w",stdout); int n,m; scanf("%d%d",&n,&m); for(int i=1;i<=n+1;i++){ string s; cin>>s; int cnt = 0,pen = 0; for(int j=1;j<=m;j++){ string r;cin>>r; if(r[0]=='-')continue; cnt++; pen += (r[1]-'0'-1)*1200 + ((r[3]-'0')*10+(r[4]-'0'))*3600+((r[6]-'0')*10+(r[7]-'0'))*60+((r[9]-'0')*10+(r[10]-'0')); } if(s=="NijeZivotJedanACM"&&i!=n+1)continue; vec.push_back({{cnt,pen},s}); } sort(vec.begin(),vec.end(),cmp); //reverse(vec.begin(),vec.end()); int idx = 0; for(int i=0;i<vec.size();i++) if(vec[i].S=="NijeZivotJedanACM") idx = i+1; printf("%d\n",idx); }

Compilation message (stderr)

acm.cpp: In function 'int main()':
acm.cpp:54:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, int>, std::__cxx11::basic_string<char> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |     for(int i=0;i<vec.size();i++)
      |                 ~^~~~~~~~~~~
acm.cpp:32:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   32 |     scanf("%d%d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...