QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#295846 | #1418. Mountain Rescue Team | 17 | 0 | 0ms | 3860kb | C++20 | 1.1kb | 2024-01-01 12:42:20 | 2024-01-01 12:42:20 |
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-MC+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);
return;
}
}
}
}
}
詳細信息
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 20
Accepted
time: 0ms
memory: 3692kb
input:
1 1 1 1 1 1
output:
Accepted
Test #2:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 2 2 2 1 1 2 3 4
output:
Accepted
Test #3:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 2 2 2 2 1 2 3 4
output:
Accepted
Test #4:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2 2 2 2 3 1 2 3 4
output:
Accepted
Test #5:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 2 2 2 4 1 2 3 4
output:
Accepted
Test #6:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
2 2 2 2 1 1 3 2 4
output:
Accepted
Test #7:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
2 2 2 2 3 1 3 2 4
output:
Accepted
Test #8:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 2 2 2 2 1 3 2 4
output:
Accepted
Test #9:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
2 2 2 2 4 1 3 2 4
output:
Accepted
Test #10:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
2 2 2 1 2 2 1 4 3
output:
Accepted
Test #11:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2 2 2 1 1 2 1 4 3
output:
Accepted
Test #12:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 2 2 1 4 2 1 4 3
output:
Accepted
Test #13:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 2 2 1 3 2 1 4 3
output:
Accepted
Test #14:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
2 2 1 2 2 2 4 1 3
output:
Accepted
Test #15:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 2 1 2 4 2 4 1 3
output:
Accepted
Test #16:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 2 1 2 1 2 4 1 3
output:
Accepted
Test #17:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
2 2 1 2 3 2 4 1 3
output:
Accepted
Test #18:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
2 2 2 1 3 3 1 4 2
output:
Accepted
Test #19:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 2 2 1 1 3 1 4 2
output:
Accepted
Test #20:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2 2 2 1 4 3 1 4 2
output:
Accepted
Test #21:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 2 2 1 2 3 1 4 2
output:
Accepted
Test #22:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
2 2 1 2 3 3 4 1 2
output:
Accepted
Test #23:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2 2 1 2 4 3 4 1 2
output:
Accepted
Test #24:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 2 1 2 1 3 4 1 2
output:
Accepted
Test #25:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 2 1 2 2 3 4 1 2
output:
Accepted
Test #26:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 2 1 1 4 4 2 3 1
output:
Accepted
Test #27:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
2 2 1 1 2 4 2 3 1
output:
Accepted
Test #28:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 2 1 1 3 4 2 3 1
output:
Accepted
Test #29:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
2 2 1 1 1 4 2 3 1
output:
Accepted
Test #30:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 2 1 1 4 4 3 2 1
output:
Accepted
Test #31:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
2 2 1 1 3 4 3 2 1
output:
Accepted
Test #32:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2 2 1 1 2 4 3 2 1
output:
Accepted
Test #33:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 2 1 1 1 4 3 2 1
output:
Accepted
Test #34:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 3 2 3 1 1 2 3 4 5 6
output:
Accepted
Test #35:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
2 3 2 3 4 1 2 4 3 5 6
output:
Accepted
Test #36:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
2 3 2 3 6 1 2 5 3 4 6
output:
Accepted
Test #37:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
2 3 2 2 5 1 3 2 4 6 5
output:
Accepted
Test #38:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
2 3 2 2 2 1 3 2 5 6 4
output:
Accepted
Test #39:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
2 3 2 3 5 1 3 4 2 5 6
output:
Accepted
Test #40:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
2 3 2 3 1 1 3 5 2 4 6
output:
Accepted
Test #41:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 3 2 2 2 1 4 2 3 6 5
output:
Accepted
Test #42:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
2 3 2 2 5 1 4 2 5 6 3
output:
Accepted
Test #43:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 3 2 2 5 1 4 3 2 6 5
output:
Accepted
Test #44:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
2 3 2 2 1 1 5 2 3 6 4
output:
Accepted
Test #45:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
2 3 2 2 2 1 5 2 4 6 3
output:
Accepted
Test #46:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
2 3 2 2 2 1 5 3 2 6 4
output:
Accepted
Test #47:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
2 3 2 2 6 2 3 1 4 6 5
output:
Accepted
Test #48:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 3 2 2 4 2 3 1 5 6 4
output:
Accepted
Test #49:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 3 2 2 6 2 4 1 3 6 5
output:
Accepted
Test #50:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 3 2 2 4 2 4 1 5 6 3
output:
Accepted
Test #51:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 3 1 3 1 2 4 6 1 3 5
output:
Accepted
Test #52:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
2 3 2 2 3 2 5 1 3 6 4
output:
Accepted
Test #53:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
2 3 2 2 4 2 5 1 4 6 3
output:
Accepted
Test #54:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
2 3 1 3 2 2 5 6 1 3 4
output:
Accepted
Test #55:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 3 1 2 6 2 6 4 1 5 3
output:
Accepted
Test #56:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 3 1 2 3 2 6 5 1 4 3
output:
Accepted
Test #57:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2 3 2 1 3 3 2 1 6 5 4
output:
Accepted
Test #58:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
2 3 2 2 1 3 4 1 5 6 2
output:
Accepted
Test #59:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2 3 1 3 1 3 4 6 1 2 5
output:
Accepted
Test #60:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
2 3 2 2 4 3 5 1 4 6 2
output:
Accepted
Test #61:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 3 1 3 4 3 5 6 1 2 4
output:
Accepted
Test #62:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
2 3 1 2 2 3 6 4 1 5 2
output:
Accepted
Test #63:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2 3 1 2 4 3 6 4 2 5 1
output:
Accepted
Test #64:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
2 3 1 2 5 3 6 5 1 4 2
output:
Accepted
Test #65:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
2 3 1 2 6 3 6 5 2 4 1
output:
Accepted
Test #66:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
2 3 2 1 1 4 2 1 6 5 3
output:
Accepted
Test #67:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2 3 2 1 4 4 3 1 6 5 2
output:
Accepted
Test #68:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
2 3 1 3 1 4 5 6 1 2 3
output:
Accepted
Test #69:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
2 3 1 2 6 4 6 2 3 5 1
output:
Accepted
Test #70:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
2 3 1 2 5 4 6 3 1 5 2
output:
Accepted
Test #71:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
2 3 1 2 1 4 6 3 2 5 1
output:
Accepted
Test #72:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2 3 1 2 2 4 6 5 1 3 2
output:
Accepted
Test #73:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 3 1 2 2 4 6 5 2 3 1
output:
Accepted
Test #74:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
2 3 2 1 3 5 2 1 6 4 3
output:
Accepted
Test #75:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
2 3 2 1 1 5 3 1 6 4 2
output:
Accepted
Test #76:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 3 1 2 2 5 6 2 3 4 1
output:
Accepted
Test #77:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
2 3 1 2 3 5 6 3 1 4 2
output:
Accepted
Test #78:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
2 3 1 2 1 5 6 3 2 4 1
output:
Accepted
Test #79:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
2 3 1 2 3 5 6 4 1 3 2
output:
Accepted
Test #80:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
2 3 1 2 1 5 6 4 2 3 1
output:
Accepted
Test #81:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
2 3 1 1 5 6 4 2 5 3 1
output:
Accepted
Test #82:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
2 3 1 1 2 6 4 3 5 2 1
output:
Accepted
Test #83:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
2 3 1 1 6 6 5 2 4 3 1
output:
Accepted
Test #84:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
2 3 1 1 3 6 5 3 4 2 1
output:
Accepted
Test #85:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
2 3 1 1 1 6 5 4 3 2 1
output:
Accepted
Test #86:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
1 3 1 3 1 1 2 3
output:
Accepted
Test #87:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
1 3 1 3 2 1 2 3
output:
Accepted
Test #88:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
1 3 1 3 3 1 2 3
output:
Accepted
Test #89:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
1 3 1 2 1 1 3 2
output:
Accepted
Test #90:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
1 3 1 2 3 1 3 2
output:
Accepted
Test #91:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
1 3 1 2 2 1 3 2
output:
Accepted
Test #92:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
1 3 1 2 2 2 3 1
output:
Accepted
Test #93:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
1 3 1 2 3 2 3 1
output:
Accepted
Test #94:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
1 3 1 2 1 2 3 1
output:
Accepted
Test #95:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
1 3 1 1 3 3 2 1
output:
Accepted
Test #96:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
1 3 1 1 2 3 2 1
output:
Accepted
Test #97:
score: 0
Accepted
time: 0ms
memory: 3800kb
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%