QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#295854 | #1418. Mountain Rescue Team | 17 | 0 | 1ms | 3680kb | C++20 | 1.2kb | 2024-01-01 12:55:39 | 2024-01-01 12:55:39 |
answer
#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
void Rescue(int R, int C, int MR, int MC, int X){
Pinpoint(1, 1);
return;
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 > 1){
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;
}
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: 1ms
memory: 3632kb
input:
1 1 1 1 1 1
output:
Accepted
Test #2:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
2 2 2 2 1 1 2 3 4
output:
Accepted
Test #3:
score: -20
Runtime Error
input:
2 2 2 2 2 1 2 3 4
output:
Wrong Answer [4]
Subtask #2:
score: 0
Skipped
Dependency #1:
0%