QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#548562#9226. Game of Geniuseszhazha21#WA 10ms3596kbC++141.8kb2024-09-05 19:18:402024-09-05 19:18:40

Judging History

你现在查看的是最新测评结果

  • [2024-09-05 19:18:40]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:3596kb
  • [2024-09-05 19:18:40]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int MAXN = 55;
int a[MAXN][MAXN], c[MAXN], C[MAXN];
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            cin >> a[i][j];
    for (int I = 0; I < n - 1; I++)
    {
        int mi;
        vector<int> m, _m;
        for (int i = 0; i < n; i++)
        {
            if (c[i])
                continue;
            _m.clear();
            for (int j = 0; j < n; j++)
                if (!C[j])
                    _m.push_back(a[i][j]);
            sort(_m.begin(), _m.end());
            bool flag = 1;
            for (int j = 0; j < m.size(); j++)
            {
                if (_m[j] < m[0])
                    break;
                else if (_m[j] > m[0])
                {
                    flag = 0;
                    break;
                }
            }
            if (flag)
                m = _m, mi = i;
        }
        c[mi] = 1;
        m.clear();
        for (int j = 0; j < n; j++)
        {
            if (C[j])
                continue;
            for (int i = 0; i < n; i++)
                if (!c[i])
                    _m.push_back(a[i][j]);
            sort(_m.begin(), _m.end());
            bool flag = 1;
            for (int i = 0; i < m.size(); i++)
            {
                if (_m[i] > m[0])
                    break;
                else if (_m[i] < m[0])
                {
                    flag = 0;
                    break;
                }
            }
            if (flag)
                m = _m, mi = j;
        }
        C[mi] = 1;
    }
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            if (!c[i] && !C[j])
                cout << a[i][j] << endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3596kb

input:

3
1 4 9
8 4 2
7 5 7

output:

5

result:

ok 1 number(s): "5"

Test #2:

score: 0
Accepted
time: 10ms
memory: 3592kb

input:

50
2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2392 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500 2500
2500 2500 2500 2500 2500 2500 2500 2500 2500 25...

output:

2500

result:

ok 1 number(s): "2500"

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3552kb

input:

10
87 94 55 220 109 210 17 114 155 34
31 189 14 214 176 130 58 104 33 37
215 116 218 162 91 1503 225 199 222 43
106 79 127 132 65 129 61 105 213 37
249 110 198 178 216 216 169 97 23 227
246 171 177 26 79 120 130 233 128 41
499 594 964 1180 539 1954 1498 1371 986 1325
46 24 91 171 85 255 2217 233 47 ...

output:

594

result:

wrong answer 1st numbers differ - expected: '499', found: '594'