QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#295842 | #1418. Mountain Rescue Team | 17 | 0 | 1ms | 3808kb | C++20 | 1.1kb | 2024-01-01 12:34:27 | 2024-01-01 12:34:27 |
answer
#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
void Rescue(int R, int C, int MR, int MC, int X){
if(R*C <= 1000){
for(int i = 1; i <= R; i++){
for(int j = 1; j <= C; j++){
if(Measure(i, j) == X){
Pinpoint(i, j);
return;
}
}
}
}
int l = 0, r = max(MR, R-MR+1) + max(MC, C-MR+1) - 2;
while(r-l > 2){
int mid = (l+r)/2;
int x = MR, y = MC;
int d = mid;
if(MR < R-MR+1){
x += min(R-MR, d);
d -= min(R-MR, d);
}else{
x -= min(MR-1, d);
d -= min(MR-1, d);
}
if(MC < C-MC+1){
y += min(C-MC, d);
d -= min(C-MC, d);
}else{
y -= min(MC-1, d);
d -= min(MC-1, d);
}
int h = Measure(x, y);
if(h == X){
Pinpoint(x, y);
return;
}
if(h < X) r = mid;
else l = mid-1;
}
for(int i = 1; i <= R; i++){
for(int j = 1; j <= C; j++){
int k = abs(i-MR)+abs(j-MC);
if(k == l || k == r){
int h = Measure(i, j);
if(h == X) Pinpoint(i, j);
}
}
}
}
詳細信息
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 20
Accepted
time: 0ms
memory: 3648kb
input:
1 1 1 1 1 1
output:
Accepted
Test #2:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
2 2 2 2 1 1 2 3 4
output:
Accepted
Test #3:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2 2 2 2 2 1 2 3 4
output:
Accepted
Test #4:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
2 2 2 2 3 1 2 3 4
output:
Accepted
Test #5:
score: 0
Accepted
time: 0ms
memory: 3468kb
input:
2 2 2 2 4 1 2 3 4
output:
Accepted
Test #6:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
2 2 2 2 1 1 3 2 4
output:
Accepted
Test #7:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
2 2 2 2 3 1 3 2 4
output:
Accepted
Test #8:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
2 2 2 2 2 1 3 2 4
output:
Accepted
Test #9:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
2 2 2 2 4 1 3 2 4
output:
Accepted
Test #10:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
2 2 2 1 2 2 1 4 3
output:
Accepted
Test #11:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
2 2 2 1 1 2 1 4 3
output:
Accepted
Test #12:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
2 2 2 1 4 2 1 4 3
output:
Accepted
Test #13:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
2 2 2 1 3 2 1 4 3
output:
Accepted
Test #14:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2 2 1 2 2 2 4 1 3
output:
Accepted
Test #15:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
2 2 1 2 4 2 4 1 3
output:
Accepted
Test #16:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
2 2 1 2 1 2 4 1 3
output:
Accepted
Test #17:
score: 0
Accepted
time: 1ms
memory: 3496kb
input:
2 2 1 2 3 2 4 1 3
output:
Accepted
Test #18:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
2 2 2 1 3 3 1 4 2
output:
Accepted
Test #19:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
2 2 2 1 1 3 1 4 2
output:
Accepted
Test #20:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
2 2 2 1 4 3 1 4 2
output:
Accepted
Test #21:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
2 2 2 1 2 3 1 4 2
output:
Accepted
Test #22:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
2 2 1 2 3 3 4 1 2
output:
Accepted
Test #23:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
2 2 1 2 4 3 4 1 2
output:
Accepted
Test #24:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
2 2 1 2 1 3 4 1 2
output:
Accepted
Test #25:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
2 2 1 2 2 3 4 1 2
output:
Accepted
Test #26:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 2 1 1 4 4 2 3 1
output:
Accepted
Test #27:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
2 2 1 1 2 4 2 3 1
output:
Accepted
Test #28:
score: 0
Accepted
time: 1ms
memory: 3756kb
input:
2 2 1 1 3 4 2 3 1
output:
Accepted
Test #29:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
2 2 1 1 1 4 2 3 1
output:
Accepted
Test #30:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
2 2 1 1 4 4 3 2 1
output:
Accepted
Test #31:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
2 2 1 1 3 4 3 2 1
output:
Accepted
Test #32:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
2 2 1 1 2 4 3 2 1
output:
Accepted
Test #33:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
2 2 1 1 1 4 3 2 1
output:
Accepted
Test #34:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
2 3 2 3 1 1 2 3 4 5 6
output:
Accepted
Test #35:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
2 3 2 3 4 1 2 4 3 5 6
output:
Accepted
Test #36:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
2 3 2 3 6 1 2 5 3 4 6
output:
Accepted
Test #37:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 3 2 2 5 1 3 2 4 6 5
output:
Accepted
Test #38:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
2 3 2 2 2 1 3 2 5 6 4
output:
Accepted
Test #39:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
2 3 2 3 5 1 3 4 2 5 6
output:
Accepted
Test #40:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
2 3 2 3 1 1 3 5 2 4 6
output:
Accepted
Test #41:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
2 3 2 2 2 1 4 2 3 6 5
output:
Accepted
Test #42:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
2 3 2 2 5 1 4 2 5 6 3
output:
Accepted
Test #43:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
2 3 2 2 5 1 4 3 2 6 5
output:
Accepted
Test #44:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 3 2 2 1 1 5 2 3 6 4
output:
Accepted
Test #45:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
2 3 2 2 2 1 5 2 4 6 3
output:
Accepted
Test #46:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
2 3 2 2 2 1 5 3 2 6 4
output:
Accepted
Test #47:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
2 3 2 2 6 2 3 1 4 6 5
output:
Accepted
Test #48:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
2 3 2 2 4 2 3 1 5 6 4
output:
Accepted
Test #49:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
2 3 2 2 6 2 4 1 3 6 5
output:
Accepted
Test #50:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
2 3 2 2 4 2 4 1 5 6 3
output:
Accepted
Test #51:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
2 3 1 3 1 2 4 6 1 3 5
output:
Accepted
Test #52:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
2 3 2 2 3 2 5 1 3 6 4
output:
Accepted
Test #53:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
2 3 2 2 4 2 5 1 4 6 3
output:
Accepted
Test #54:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
2 3 1 3 2 2 5 6 1 3 4
output:
Accepted
Test #55:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
2 3 1 2 6 2 6 4 1 5 3
output:
Accepted
Test #56:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
2 3 1 2 3 2 6 5 1 4 3
output:
Accepted
Test #57:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
2 3 2 1 3 3 2 1 6 5 4
output:
Accepted
Test #58:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
2 3 2 2 1 3 4 1 5 6 2
output:
Accepted
Test #59:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 3 1 3 1 3 4 6 1 2 5
output:
Accepted
Test #60:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
2 3 2 2 4 3 5 1 4 6 2
output:
Accepted
Test #61:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
2 3 1 3 4 3 5 6 1 2 4
output:
Accepted
Test #62:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
2 3 1 2 2 3 6 4 1 5 2
output:
Accepted
Test #63:
score: 0
Accepted
time: 1ms
memory: 3792kb
input:
2 3 1 2 4 3 6 4 2 5 1
output:
Accepted
Test #64:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
2 3 1 2 5 3 6 5 1 4 2
output:
Accepted
Test #65:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
2 3 1 2 6 3 6 5 2 4 1
output:
Accepted
Test #66:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2 3 2 1 1 4 2 1 6 5 3
output:
Accepted
Test #67:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 3 2 1 4 4 3 1 6 5 2
output:
Accepted
Test #68:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
2 3 1 3 1 4 5 6 1 2 3
output:
Accepted
Test #69:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
2 3 1 2 6 4 6 2 3 5 1
output:
Accepted
Test #70:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
2 3 1 2 5 4 6 3 1 5 2
output:
Accepted
Test #71:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
2 3 1 2 1 4 6 3 2 5 1
output:
Accepted
Test #72:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
2 3 1 2 2 4 6 5 1 3 2
output:
Accepted
Test #73:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
2 3 1 2 2 4 6 5 2 3 1
output:
Accepted
Test #74:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
2 3 2 1 3 5 2 1 6 4 3
output:
Accepted
Test #75:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
2 3 2 1 1 5 3 1 6 4 2
output:
Accepted
Test #76:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
2 3 1 2 2 5 6 2 3 4 1
output:
Accepted
Test #77:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
2 3 1 2 3 5 6 3 1 4 2
output:
Accepted
Test #78:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
2 3 1 2 1 5 6 3 2 4 1
output:
Accepted
Test #79:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2 3 1 2 3 5 6 4 1 3 2
output:
Accepted
Test #80:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
2 3 1 2 1 5 6 4 2 3 1
output:
Accepted
Test #81:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
2 3 1 1 5 6 4 2 5 3 1
output:
Accepted
Test #82:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
2 3 1 1 2 6 4 3 5 2 1
output:
Accepted
Test #83:
score: 0
Accepted
time: 1ms
memory: 3792kb
input:
2 3 1 1 6 6 5 2 4 3 1
output:
Accepted
Test #84:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
2 3 1 1 3 6 5 3 4 2 1
output:
Accepted
Test #85:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 3 1 1 1 6 5 4 3 2 1
output:
Accepted
Test #86:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
1 3 1 3 1 1 2 3
output:
Accepted
Test #87:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
1 3 1 3 2 1 2 3
output:
Accepted
Test #88:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
1 3 1 3 3 1 2 3
output:
Accepted
Test #89:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
1 3 1 2 1 1 3 2
output:
Accepted
Test #90:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
1 3 1 2 3 1 3 2
output:
Accepted
Test #91:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
1 3 1 2 2 1 3 2
output:
Accepted
Test #92:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
1 3 1 2 2 2 3 1
output:
Accepted
Test #93:
score: 0
Accepted
time: 1ms
memory: 3792kb
input:
1 3 1 2 3 2 3 1
output:
Accepted
Test #94:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
1 3 1 2 1 2 3 1
output:
Accepted
Test #95:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 3 1 1 3 3 2 1
output:
Accepted
Test #96:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
1 3 1 1 2 3 2 1
output:
Accepted
Test #97:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
1 3 1 1 1 3 2 1
output:
Accepted
Test #98:
score: -20
Runtime Error
input:
50 50 25 25 951985666 44544131 91526867 92591638 92602827 92850682 94092196 94130437 94362739 95149431 95201023 95299737 95530146 95703930 95830638 96161652 96177425 96283355 96288537 105014073 105460298 105598741 105699224 106604830 107427962 173165535 108162651 103558891 103356567 101280031 534453...
output:
Wrong Answer [2]
Subtask #2:
score: 0
Skipped
Dependency #1:
0%