답안 #234590

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
234590 2020-05-24T17:44:08 Z Vimmer Hokej (COCI17_hokej) C++14
0 / 120
425 ms 18424 KB
#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;

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];

    vector <pair <pair <int, int>, int> > g(n);

    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());

    int j = 0, kol = 0;

    ll ans = 0;

    for (int u = 0; u < 6; u++)
        for (int i = 0; i < m; i++)
        {
            if (kol == m) {j++; i--; kol = 0; continue;}

            kol++;

            a[i][u] = g[j].S;

            ans += g[j].F.F;

            g[j].F.S--;

            if (g[j].F.S == 0) {kol = 0; j++;}
        }

    cout << ans << endl;

    for (int i = 0; i < 6; i++) cout << a[0][i] + 1 << " "; cout << endl;

    vector <int> pr; pr.clear();

    for (int i = 0; i < 6; i++) pr.pb(a[0][i]);

    sort(pr.begin(), pr.end());

    kol = 0;

    for (int i = 1; i < m; i++)
    {
        vector <int> gr; gr.clear();

        for (int j = 0; j < 6; j++) gr.pb(a[i][j]);

        sort(gr.begin(), gr.end());

        for (int j = 0; j < 6; j++)
          if (gr[j] != pr[j]) kol++;

        pr = gr;
    }

    cout << kol << endl;

    pr.clear();

    for (int i = 0; i < 6; i++) pr.pb(a[0][i]);

    sort(pr.begin(), pr.end());

    for (int i = 1; i < m; i++)
    {
        vector <int> gr; gr.clear();

        for (int j = 0; j < 6; j++) gr.pb(a[i][j]);

        sort(gr.begin(), gr.end());

        for (int j = 0; j < 6; j++)
          if (gr[j] != pr[j]) cout << i << " " << pr[j] + 1 << " " << gr[j] + 1 << endl;

        pr = gr;
    }
}

Compilation message

hokej.cpp: In function 'int main()':
hokej.cpp:69: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:69: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;
                                                             ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Incorrect 8 ms 512 KB Output isn't correct
3 Incorrect 239 ms 12536 KB Output isn't correct
4 Incorrect 6 ms 384 KB Output isn't correct
5 Incorrect 105 ms 5240 KB Output isn't correct
6 Incorrect 9 ms 384 KB Output isn't correct
7 Incorrect 8 ms 512 KB Output isn't correct
8 Incorrect 101 ms 3064 KB Output isn't correct
9 Incorrect 413 ms 18296 KB Output isn't correct
10 Incorrect 425 ms 18424 KB Output isn't correct