Submission #234577

#TimeUsernameProblemLanguageResultExecution timeMemory
234577VimmerHokej (COCI17_hokej)C++14
48 / 120
222 ms65540 KiB
#include <bits/stdc++.h> //#pragma GCC optimize("unroll-loops") //#pragma GCC optimize("-O3") //#pragma GCC optimize("Ofast") #define F first #define S second #define sz(x) int(x.size()) #define pb push_back #define N 500005 #define M ll(1e9 + 7) #define inf 1e9 + 1e9 using namespace std; typedef long double ld; typedef long long ll; typedef short int si; set <int> se[N]; int main() { //freopen("input.txt", "r", stdin);// freopen("output.txt", "w", stdout); ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0); int m, n; cin >> m >> n; int a[m][6], obr[n]; vector <pair <pair <int, int>, int> > g(n); vector <pair <int, pair <int, int> > > vr; vr.clear(); for (int i = 0; i < n; i++) { g[i].S = i; cin >> g[i].F.F >> g[i].F.S; } sort(g.begin(), g.end()); reverse(g.begin(), g.end()); for (int i = 0; i < n; i++) obr[g[i].S] = i; int j = 0; for (int u = 0; u < 6; u++) for (int i = 0; i < m; i++) { if (se[i].find(g[j].S) != se[i].end()) {j++; i--; continue;} a[i][u] = g[j].S; se[i].insert(g[j].S); g[j].F.S--; if (g[j].F.S == 0) j++; } ll ans = 0; for (int i = 0; i < 6; i++) ans += g[obr[a[0][i]]].F.F; for (int i = 1; i < m; i++) for (int j = 0; j < 6; j++) { ans += g[obr[a[i][j]]].F.F; if (a[i][j] != a[i - 1][j]) vr.pb({i, {a[i - 1][j], a[i][j]}}); } cout << ans << endl; for (int i = 0; i < 6; i++) cout << a[0][i] + 1 << " "; cout << endl; cout << sz(vr) << endl; for (auto it : vr) cout << it.F << " " << it.S.F + 1 << " " << it.S.S + 1 << endl; }

Compilation message (stderr)

hokej.cpp: In function 'int main()':
hokej.cpp:84:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (int i = 0; i < 6; i++) cout << a[0][i] + 1 << " "; cout << endl;
     ^~~
hokej.cpp:84:61: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     for (int i = 0; i < 6; i++) cout << a[0][i] + 1 << " "; cout << endl;
                                                             ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...