QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#528137#1833. DeletingxlwangWA 2ms8196kbC++141.7kb2024-08-23 10:15:202024-08-23 10:15:21

Judging History

This is the latest submission verdict.

  • [2024-08-23 10:15:21]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 8196kb
  • [2024-08-23 10:15:20]
  • Submitted

answer

#include<bits/stdc++.h>
#define ll long long
#define fr(i,j,k) for(register int i=j;i<=k;++i)
#define rf(i,j,k) for(register int i=j;i>=k;--i)
#define foredge(i,j) for(register int i=head[j];i;i=e[i].nxt)
#define pb push_back
#define Times printf("Time:%.3lf\n",clock()/CLOCKS_PER_SEC)
#define pii pair<int,int>
#define mk make_pair
using namespace std;
inline int read(){
	int x=0;
	bool f=0;
	char c=getchar();
	while(!isdigit(c)) f|=(c=='-'),c=getchar();
	while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f?-x:x;
}
inline void write(int x){
    if(x<0){putchar('-');x=-x;}
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
inline void writeln(int x){write(x); puts("");}
inline void writepl(int x){write(x); putchar(' ');}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline int randfind(int l,int r){return rnd()%(r-l+1)+l;}
//inline void init(){
//	int t=read();
//	while(t--) work();
//}
const int Maxn=4e3+10;
bitset<Maxn> bt[Maxn];
int n;
int a[Maxn][Maxn];
inline void init(){
    n=read();
    fr(i,1,n) for(int j=i+1;j<=n;j+=2) a[i][j]=read();
}
inline bool check(int x){
    fr(i,1,n) bt[i].reset();
    fr(i,1,n) bt[i+1][i]=1;
    rf(l,n,1) for(int r=l+1;r<=n;r+=2){
        if(bt[l+1][r-1] && a[l][r]<=x) bt[l][r]=1;
        if(bt[l][r]) bt[l]|=bt[r];
    }return bt[1][n];
}
inline void work(){
    int l=1,r=(n/2)*(n/2),ans=0;
    while(l<=r){
        int mid;mid=(l+r)>>1;
        if(check(mid)) ans=mid,r=mid-1;
        else l=mid+1;
    }writeln(ans);
}
signed main(){
	// freopen("input.in","r",stdin);
	// freopen("output.out","w",stdout);
    init();work();
    // printf("\nTIME:%.3lf",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
1

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 1ms
memory: 5840kb

input:

6
2 1 3
4 5
6 7
8
9

output:

6

result:

ok 1 number(s): "6"

Test #3:

score: 0
Accepted
time: 1ms
memory: 5636kb

input:

10
20 21 2 11 25
3 24 18 8
6 17 7 5
22 4 23
14 15 1
19 16
12 10
13
9

output:

14

result:

ok 1 number(s): "14"

Test #4:

score: 0
Accepted
time: 1ms
memory: 5816kb

input:

16
49 48 18 41 52 64 4 6
22 20 32 50 56 36 9
3 1 27 58 51 35 40
61 43 38 12 7 34
8 59 39 25 46 16
44 29 15 17 24
10 47 2 57 62
14 5 23 33
30 45 19 60
63 28 13
54 55 26
53 31
11 42
21
37

output:

30

result:

ok 1 number(s): "30"

Test #5:

score: 0
Accepted
time: 1ms
memory: 5832kb

input:

20
91 19 90 92 5 41 15 50 18 36
97 8 23 74 53 67 83 40 26
4 16 31 82 80 28 49 6 21
58 63 70 34 27 89 68 20
55 100 35 77 52 24 11 87
94 13 66 1 32 54 86
60 79 75 93 45 73 2
48 72 12 37 29 95
56 17 44 84 30 22
14 65 76 69 62
47 78 7 57 42
39 61 99 81
88 25 98 59
85 38 10
33 51 71
64 46
43 3
96
9

output:

54

result:

ok 1 number(s): "54"

Test #6:

score: -100
Wrong Answer
time: 2ms
memory: 8196kb

input:

100
750 481 1065 911 1943 427 1633 45 1841 234 1376 1075 1603 1682 1581 1284 28 5 1567 1540 2409 1430 695 667 1246 392 1183 1090 594 1481 524 2023 354 778 584 827 1516 796 1675 1829 189 1688 706 1679 1483 1010 1209 1393 399 210
40 149 1040 351 1435 320 340 577 898 449 1896 224 2168 1456 1222 1216 19...

output:

1339

result:

wrong answer 1st numbers differ - expected: '1289', found: '1339'