Submission #1193948

#TimeUsernameProblemLanguageResultExecution timeMemory
1193948SmuggingSpunACM (COCI19_acm)C++20
50 / 50
1 ms400 KiB
#include<bits/stdc++.h> #define taskname "A" using namespace std; struct Data{ string name; int cnt, time; Data(){ this->cnt = this->time = 0; } Data(string _name, int _cnt, int _time) : name(_name), cnt(_cnt), time(_time) {} bool operator <(const Data& other){ return this->cnt > other.cnt || (this->cnt == other.cnt && this->time < other.time) || (this->cnt == other.cnt && this->time == other.time && this->name < other.name); } }; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } int n, m; cin >> n >> m; vector<Data>a(n + 1); for(auto& [name, cnt, time] : a){ cin >> name; for(int i = 0; i < m; i++){ string s; cin >> s; if(s[0] != '-'){ if(name != "NijeZivotJedanACM" || s[0] == '+'){ cnt++; time += (s[1] - 48) * 1200 + (s[4] - 48) * 3600 + ((s[6] - 48) * 10 + s[7]) * 60 + (s[9] - 48) * 10 + s[10] - 48; } } } } sort(a.begin(), a.end()); for(int i = 0; i < n; i++){ if(a[i].name == "NijeZivotJedanACM"){ return cout << i + 1, 0; } } }

Compilation message (stderr)

acm.cpp: In function 'int main()':
acm.cpp:18:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...