Submission #711611

#TimeUsernameProblemLanguageResultExecution timeMemory
711611guagua0407ACM (COCI19_acm)C++17
50 / 50
3 ms852 KiB
//#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define f first #define s second #define all(x) x.begin(),x.end() #define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } int main() {_ int n,m; cin>>n>>m; string res[n][m]; string name[n]; int node=0; for(int i=0;i<n;i++){ cin>>name[i]; if(name[i]=="NijeZivotJedanACM"){ node=i; } for(int j=0;j<m;j++){ cin>>res[i][j]; } } cin>>name[node]; for(int j=0;j<m;j++){ cin>>res[node][j]; } vector<pair<pair<ll,ll>,string>> vec; for(int i=0;i<n;i++){ if(i==node) continue; ll cnt=0; ll tm=0; for(int j=0;j<m;j++){ if(res[i][j][0]=='-') continue; cnt++; tm+=(res[i][j][1]-'0'-1)*20*60; int a=res[i][j][3]-'0'; a=a*10+res[i][j][4]-'0'; tm+=a*60*60; a=res[i][j][6]-'0'; a=a*10+res[i][j][7]-'0'; tm+=a*60; a=res[i][j][9]-'0'; a=a*10+res[i][j][10]-'0'; tm+=a; } vec.push_back({{-cnt,tm},name[i]}); } ll cnt=0; ll tm=0; int i=node; for(int j=0;j<m;j++){ if(res[i][j][0]=='-') continue; cnt++; tm+=(res[i][j][1]-'0'-1)*20*60; int a=res[i][j][3]-'0'; a=a*10+res[i][j][4]-'0'; tm+=a*60*60; a=res[i][j][6]-'0'; a=a*10+res[i][j][7]-'0'; tm+=a*60; a=res[i][j][9]-'0'; a=a*10+res[i][j][10]-'0'; tm+=a; } sort(all(vec)); /*for(auto v:vec){ cout<<v.f.f<<' '<<v.f.s<<' '<<v.s<<'\n'; }*/ pair<pair<ll,ll>,string> tmp={{-cnt,tm},name[node]}; //cout<<tmp.f.f<<' '<<tmp.f.s<<' '<<tmp.s<<'\n'; auto it=lower_bound(all(vec),tmp); cout<<it-vec.begin()+1; return 0; } //maybe its multiset not set

Compilation message (stderr)

acm.cpp: In function 'void setIO(std::string)':
acm.cpp:12:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
acm.cpp:13:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     freopen((s + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...