Submission #1023729

#TimeUsernameProblemLanguageResultExecution timeMemory
1023729caterpillowGo (COCI16_go)C++17
50 / 50
1 ms600 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pl = pair<ll, ll>; using pi = pair<int, int>; #define vt vector #define f first #define s second #define pb push_back #define all(x) x.begin(), x.end() #define size(x) ((int) (x).size()) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define ROF(i, a, b) for (int i = (b) - 1; i >= (a); i--) #define F0R(i, b) FOR (i, 0, b) #define endl '\n' const ll INF = 1e18; const int inf = 1e9; main() { cin.tie(0)->sync_with_stdio(0); int n; cin >> n; vt<string> names(n); vt<pl> costs(n); F0R (i, n) cin >> names[i] >> costs[i].f >> costs[i].s; ll best = -1; string name = ""; int ans = 0; F0R (i, n) { int cnt = 0; while (costs[i].s >= costs[i].f) { costs[i].s -= costs[i].f; costs[i].s += 2; cnt++; } ans += cnt; if (cnt > best) name = names[i], best = cnt; } cout << ans << endl << name << endl; }

Compilation message (stderr)

go.cpp:21:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   21 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...