QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#581769 | #9226. Game of Geniuses | ricofx# | WA | 2ms | 4004kb | C++17 | 2.2kb | 2024-09-22 14:09:32 | 2024-09-22 14:09:33 |
Judging History
answer
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const int N = 50 + 5;
int n;
int a[N][N];
bool vis[N][N];
int row[N][N], col[N][N];
int cmp(int *x,int *y){
for(int i=1;i<=n;++i)
if(x[i] != y[i])
return x[i] < y[i] ? -1 : 1;
return 0;
}
void MAIN() {
cin >> n;
for(int i = 1; i <=n ;++i)
for(int j=1;j<=n;++j)
cin >> a[i][j];
for(int tim=1;tim<n;++tim){
int p = 1;
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j)
if(!vis[i][j])
row[i][j] = a[i][j];
else
row[i][j] = inf;
sort(row[i]+1,row[i]+1+n);
// if(row[i] < row[p])
if(cmp(row[i],row[p]) == -1)
p = i;
}
for(int j=1;j<=n;++j)
vis[p][j] = 1;
p = 1;
for(int j=1;j<=n;++j){
for(int i=1;i<=n;++i)
if(!vis[i][j])
col[j][i] = a[i][j];
else
col[j][i] = 0;
sort(col[j]+1,col[j]+1+n,[&](int x,int y){return x>y;});
if(cmp(col[j], col[p]) == 1)
p = j;
}
for(int i=1;i<=n;++i)
vis[i][p] = 1;
}
for(int i=1;i<=n;++i)
for(int j=1;j<=n;++j)
if(!vis[i][j])
printf("%d\n",a[i][j]);
}
int main() {
#ifdef LOCAL
auto start = chrono::steady_clock::now();
freopen("miku.in", "r", stdin);
freopen("miku.out", "w", stdout);
#endif
ios::sync_with_stdio(0); cin.tie(0);
int T = 1;
// cin >> T;
while (T--) MAIN();
#ifdef LOCAL
auto end = chrono::steady_clock::now();
cout << "\nqwq: " << chrono::duration_cast<chrono::milliseconds>(end - start).count() << "ms\n";
#endif
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3860kb
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: 2ms
memory: 4004kb
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: 0
Accepted
time: 0ms
memory: 3792kb
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:
499
result:
ok 1 number(s): "499"
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3852kb
input:
27 411 303 81 355 191 660 575 150 26 190 659 491 503 105 392 665 710 111 176 25 395 105 234 247 528 641 315 198 707 101 112 342 282 217 457 653 271 261 689 437 155 570 725 386 146 711 498 40 315 502 717 376 52 311 426 271 176 178 365 442 703 547 47 470 633 532 437 634 620 466 539 465 628 8 267 145 2...
output:
378
result:
wrong answer 1st numbers differ - expected: '166', found: '378'