QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#579675 | #9226. Game of Geniuses | guodong# | WA | 4ms | 3660kb | C++14 | 1.8kb | 2024-09-21 16:55:40 | 2024-09-21 16:55:40 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define For(x, l, r) for(int x = l; x <= r; x++)
using namespace std;
const int N = 52;
int n;
int A[N][N];
int C[N][N];
int Row[N],Col[N];
void Markrow(int x){
For(j,1,n)
C[x][j] = -1;
}
void Markcol(int y){
For(i,1,n)
C[i][y] = -1;
}
void upd(){
For(i,1,n) Row[i] = Col[i] = 0;
For(i,1,n){
For(j,1,n){
if(C[i][j] == -1)
continue;
if(C[i][j] == 0){
Row[i]++;
}
else{
Col[j]++;
}
}
}
}
void Change(int v){
For(i,1,n){
For(j,1,n){
if(A[i][j] >= v)
C[i][j] = 1;
else
C[i][j] = 0;
}
}
}
int Judge(int v){
Change(v);
upd();
For(step,1,n-1){
int maxx = -1;
int maxpos = 0;
For(i,1,n){
if(Row[i] >= maxx){
maxx = Row[i];
maxpos = i;
}
}
Markrow(maxpos); upd();
maxx = -1;
maxpos = 0;
For(i,1,n){
if(Col[i] >= maxx){
maxx = Col[i];
maxpos = i;
}
}
Markcol(maxpos); upd();
}
int t = -1;
For(i,1,n)
For(j,1,n)
if(C[i][j] != -1){
t = C[i][j];
break;
}
assert(t != -1);
return t;
}
signed main(){
#ifdef NICEGUODONG
freopen("data.in","r",stdin);
// freopen("b.out","w",stdout);
auto start = std::chrono::high_resolution_clock::now();
#endif
cin >> n;
int minn = 1e9;
int maxx = -1;
For(i,1,n){
For(j,1,n){
cin >> A[i][j];
minn = min (minn,A[i][j]);
maxx = max (maxx,A[i][j]);
}
}
int l = minn ,r = maxx;
int ans = 0;
while(l <= r){
int mid = (l + r) >> 1;
if(Judge(mid)){
ans = mid ;
l = mid + 1;
}
else
r = mid - 1;
}
cout << ans << '\n';
#ifdef NICEGUODONG
auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> duration = end - start;
std::cerr << "Runtime: " << duration.count() << " sec" << std::endl;
#endif
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3656kb
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: 4ms
memory: 3616kb
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: 3568kb
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: 0
Accepted
time: 1ms
memory: 3660kb
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:
166
result:
ok 1 number(s): "166"
Test #5:
score: -100
Wrong Answer
time: 4ms
memory: 3612kb
input:
47 1924 592 1145 696 1686 2088 1535 2134 276 2118 1237 441 1255 1738 419 2099 150 653 1842 967 1573 1444 1713 1227 245 1623 1890 708 1629 795 1409 1742 499 966 883 50 1456 1194 1193 2056 1531 557 479 1092 973 1834 1311 1805 768 769 990 324 1836 87 1971 1672 1794 1155 1442 135 1634 628 214 572 2010 9...
output:
708
result:
wrong answer 1st numbers differ - expected: '247', found: '708'