QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#606862#3873. Towerswjy202012 999ms62056kbC++142.0kb2024-10-03 12:44:092024-10-03 12:44:11

Judging History

This is the latest submission verdict.

  • [2024-10-03 12:44:11]
  • Judged
  • Verdict: 12
  • Time: 999ms
  • Memory: 62056kb
  • [2024-10-03 12:44:09]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
// #define int long long 
#define sfor(i,j,k) for(register int i=j;i<=k;++i)
#define dfor(i,j,k) for(register int i=k;i>=j;--i)
inline int read(){
    register int x = 0, t = 1;
    register char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            t=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*t;
}
inline void write(int x)
{
    if(x<0){
    	putchar('-');
		x=-x;
	}
    if(x>9) 
		write(x/10);
    putchar(x%10+'0');
}
struct da{
	int x,y,num;
}zs[1200005],zx[1200005],ys[1200005],yx[1200005];//左上,左下,右上,右下 
bool cmpzs(da a,da b)
  {if(a.x==b.x) {return a.y<b.y;}
   return a.x<b.x;
  }
bool cmpzx(da a,da b)
  {if(a.x==b.x) {return a.y<b.y;}
   return a.x>b.x;
  }
bool cmpys(da a,da b)
  {if(a.x==b.x) {return a.y>b.y;}
   return a.x<b.x;
  }
bool cmpyx(da a,da b)
  {if(a.x==b.x) {return a.y>b.y;}
   return a.x>b.x;
  }
bool l[1200005],r[1200005],s[120005],x[1200005],ans[1200005];
int main()
{
int n=read(),inn,jnn;
sfor(i,1,n)
  {cin>>inn>>jnn;
   zs[i].x=inn,zs[i].y=jnn,zs[i].num=i;
   zx[i].x=inn,zx[i].y=jnn,zx[i].num=i;
   ys[i].x=inn,ys[i].y=jnn,ys[i].num=i;
   yx[i].x=inn,yx[i].y=jnn,yx[i].num=i;
  }
sort(zs+1,zs+1+n,cmpzs);
sort(zx+1,zx+1+n,cmpzx);
sort(ys+1,ys+1+n,cmpys);
sort(yx+1,yx+1+n,cmpyx);
int zsw=1,zxw=1,ysw=1,yxw=1;
while(zsw<=n&&zxw<=n&&ysw<=n&&yxw<=n)
  {while((l[zs[zsw].x]||s[zs[zsw].y])&&zsw<=n) zsw++;
   while((l[zx[zxw].x]||x[zx[zxw].y])&&zxw<=n) zxw++;
   while((r[ys[ysw].x]||s[ys[ysw].y])&&ysw<=n) ysw++;
   while((r[yx[yxw].x]||x[yx[yxw].y])&&yxw<=n) yxw++;
   l[zs[zsw].x]=s[zs[zsw].y]=1;
   l[zx[zxw].x]=x[zx[zxw].y]=1;
   r[ys[ysw].x]=s[ys[ysw].y]=1;
   r[yx[yxw].x]=x[yx[yxw].y]=1;
   ans[zs[zsw].num]=ans[zx[zxw].num]=ans[ys[ysw].num]=ans[yx[yxw].num]=1;
  }
sfor(i,1,n) cout<<ans[i];
return 0;
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 0ms
memory: 11936kb

input:

2
869400 218695
664808 31410

output:

11

result:

ok 

Test #2:

score: 5
Accepted
time: 0ms
memory: 11960kb

input:

2
195447 154323
271823 133730

output:

11

result:

ok 

Test #3:

score: 5
Accepted
time: 0ms
memory: 11800kb

input:

3
751594 545975
951568 859051
621150 686048

output:

111

result:

ok 

Test #4:

score: 5
Accepted
time: 0ms
memory: 11888kb

input:

3
404592 259430
770816 43371
147329 582162

output:

111

result:

ok 

Test #5:

score: 5
Accepted
time: 0ms
memory: 11940kb

input:

3
401670 296316
401670 809250
401670 595959

output:

110

result:

ok 

Test #6:

score: 5
Accepted
time: 0ms
memory: 11928kb

input:

3
657802 927690
657802 872623
657802 83083

output:

101

result:

ok 

Test #7:

score: 5
Accepted
time: 0ms
memory: 11884kb

input:

3
759291 185618
759291 386687
759291 100713

output:

011

result:

ok 

Test #8:

score: 5
Accepted
time: 3ms
memory: 11932kb

input:

3
997737 106763
684497 106763
412296 106763

output:

101

result:

ok 

Test #9:

score: 5
Accepted
time: 0ms
memory: 11884kb

input:

3
305388 642835
538743 642835
608034 642835

output:

101

result:

ok 

Test #10:

score: 5
Accepted
time: 0ms
memory: 11864kb

input:

3
420692 202248
784725 202248
931773 202248

output:

101

result:

ok 

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #11:

score: 0
Wrong Answer
time: 3ms
memory: 11884kb

input:

16
296455 404592
582162 770816
807435 536085
259430 536085
112538 770816
610915 369095
582162 369095
94860 147329
112538 147329
296455 61932
259430 147329
807435 369095
610915 404592
807435 309191
807435 61932
94860 770816

output:

1111010111001011

result:

wrong answer 

Subtask #3:

score: 7
Accepted

Test #26:

score: 7
Accepted
time: 42ms
memory: 18148kb

input:

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

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #27:

score: 7
Accepted
time: 57ms
memory: 14092kb

input:

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

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #28:

score: 7
Accepted
time: 147ms
memory: 28252kb

input:

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

output:

100000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000001000100000000000000000000000000000000000000000000000100000100000000000000000000000000000000000000000000010000000100000000000000000000000000000000000000000001000000000100000000000000000000000000000...

result:

ok 

Test #29:

score: 7
Accepted
time: 300ms
memory: 43064kb

input:

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

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #30:

score: 7
Accepted
time: 55ms
memory: 16036kb

input:

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

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010...

result:

ok 

Test #31:

score: 7
Accepted
time: 9ms
memory: 11952kb

input:

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

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000...

result:

ok 

Test #32:

score: 7
Accepted
time: 335ms
memory: 41120kb

input:

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

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #33:

score: 7
Accepted
time: 202ms
memory: 28556kb

input:

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

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #34:

score: 7
Accepted
time: 532ms
memory: 55768kb

input:

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

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #35:

score: 7
Accepted
time: 391ms
memory: 51532kb

input:

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

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #36:

score: 7
Accepted
time: 476ms
memory: 61904kb

input:

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

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #37:

score: 7
Accepted
time: 478ms
memory: 62056kb

input:

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

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Subtask #4:

score: 0
Wrong Answer

Test #38:

score: 0
Wrong Answer
time: 999ms
memory: 60556kb

input:

1000000
1 18543
4 40327
7 19084
8 44274
10 42366
12 22173
13 9862
15 44706
19 48070
21 13389
24 39273
26 18680
27 46858
28 46126
32 27753
34 28289
36 12220
38 39235
42 28505
45 47348
46 34220
48 47551
50 49156
54 8856
55 25515
56 21932
58 24482
59 20686
61 41381
66 30112
67 44504
70 24510
71 26418
7...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

wrong answer 

Subtask #5:

score: 0
Skipped

Dependency #2:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Wrong Answer

Test #85:

score: 0
Wrong Answer
time: 589ms
memory: 61988kb

input:

1000000
1 602300
1 778881
2 397065
3 291452
3 678039
5 235300
6 499367
8 8597
10 327718
10 516489
12 416542
12 440048
13 284169
13 383581
13 642202
13 770858
14 378154
14 710033
15 905531
16 50155
17 142259
19 395613
19 500321
20 358934
21 461772
24 562953
24 995887
25 421244
27 900412
29 301006
31 ...

output:

111111111111100111111111111111101111110111101101111111111111111111111111111111111101111110111111111111110011111011111111111111111111111001111011111001100111101111111111000111111111111111000111111111101111111011111111111111110111111111111111111101111111110111111111011111111111111111111111110110011111...

result:

wrong answer