QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#295859 | #1418. Mountain Rescue Team | 17 | 0 | 1ms | 3980kb | C++20 | 994b | 2024-01-01 13:02:41 | 2024-01-01 13:02:42 |
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;
}
}
}
}
map<int, pair<int, int>> m;
for(int i = 1; i <= R; i++){
for(int j = 1; j <= C; j++){
m[abs(i-MR)+abs(j-MC)] = {i, j};
}
}
int l = 0, r = max(MR, R-MR+1) + max(MC, C-MR+1) - 2;
while(r-l > 1){
int mid = (l+r)/2;
int x = m[mid].first, y = m[mid].second;
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);
}
}
}
Pinpoint(1, 1);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 20
Accepted
time: 0ms
memory: 3660kb
input:
1 1 1 1 1 1
output:
Accepted
Test #2:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
2 2 2 2 1 1 2 3 4
output:
Accepted
Test #3:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
2 2 2 2 2 1 2 3 4
output:
Accepted
Test #4:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
2 2 2 2 3 1 2 3 4
output:
Accepted
Test #5:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
2 2 2 2 4 1 2 3 4
output:
Accepted
Test #6:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
2 2 2 2 1 1 3 2 4
output:
Accepted
Test #7:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
2 2 2 2 3 1 3 2 4
output:
Accepted
Test #8:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
2 2 2 2 2 1 3 2 4
output:
Accepted
Test #9:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
2 2 2 2 4 1 3 2 4
output:
Accepted
Test #10:
score: 0
Accepted
time: 1ms
memory: 3740kb
input:
2 2 2 1 2 2 1 4 3
output:
Accepted
Test #11:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
2 2 2 1 1 2 1 4 3
output:
Accepted
Test #12:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
2 2 2 1 4 2 1 4 3
output:
Accepted
Test #13:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
2 2 2 1 3 2 1 4 3
output:
Accepted
Test #14:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
2 2 1 2 2 2 4 1 3
output:
Accepted
Test #15:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
2 2 1 2 4 2 4 1 3
output:
Accepted
Test #16:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
2 2 1 2 1 2 4 1 3
output:
Accepted
Test #17:
score: 0
Accepted
time: 0ms
memory: 3972kb
input:
2 2 1 2 3 2 4 1 3
output:
Accepted
Test #18:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
2 2 2 1 3 3 1 4 2
output:
Accepted
Test #19:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
2 2 2 1 1 3 1 4 2
output:
Accepted
Test #20:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
2 2 2 1 4 3 1 4 2
output:
Accepted
Test #21:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
2 2 2 1 2 3 1 4 2
output:
Accepted
Test #22:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
2 2 1 2 3 3 4 1 2
output:
Accepted
Test #23:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
2 2 1 2 4 3 4 1 2
output:
Accepted
Test #24:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
2 2 1 2 1 3 4 1 2
output:
Accepted
Test #25:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
2 2 1 2 2 3 4 1 2
output:
Accepted
Test #26:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
2 2 1 1 4 4 2 3 1
output:
Accepted
Test #27:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
2 2 1 1 2 4 2 3 1
output:
Accepted
Test #28:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
2 2 1 1 3 4 2 3 1
output:
Accepted
Test #29:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
2 2 1 1 1 4 2 3 1
output:
Accepted
Test #30:
score: 0
Accepted
time: 1ms
memory: 3776kb
input:
2 2 1 1 4 4 3 2 1
output:
Accepted
Test #31:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 2 1 1 3 4 3 2 1
output:
Accepted
Test #32:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
2 2 1 1 2 4 3 2 1
output:
Accepted
Test #33:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
2 2 1 1 1 4 3 2 1
output:
Accepted
Test #34:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
2 3 2 3 1 1 2 3 4 5 6
output:
Accepted
Test #35:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
2 3 2 3 4 1 2 4 3 5 6
output:
Accepted
Test #36:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
2 3 2 3 6 1 2 5 3 4 6
output:
Accepted
Test #37:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
2 3 2 2 5 1 3 2 4 6 5
output:
Accepted
Test #38:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
2 3 2 2 2 1 3 2 5 6 4
output:
Accepted
Test #39:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
2 3 2 3 5 1 3 4 2 5 6
output:
Accepted
Test #40:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
2 3 2 3 1 1 3 5 2 4 6
output:
Accepted
Test #41:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
2 3 2 2 2 1 4 2 3 6 5
output:
Accepted
Test #42:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
2 3 2 2 5 1 4 2 5 6 3
output:
Accepted
Test #43:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
2 3 2 2 5 1 4 3 2 6 5
output:
Accepted
Test #44:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
2 3 2 2 1 1 5 2 3 6 4
output:
Accepted
Test #45:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
2 3 2 2 2 1 5 2 4 6 3
output:
Accepted
Test #46:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
2 3 2 2 2 1 5 3 2 6 4
output:
Accepted
Test #47:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
2 3 2 2 6 2 3 1 4 6 5
output:
Accepted
Test #48:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
2 3 2 2 4 2 3 1 5 6 4
output:
Accepted
Test #49:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 3 2 2 6 2 4 1 3 6 5
output:
Accepted
Test #50:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
2 3 2 2 4 2 4 1 5 6 3
output:
Accepted
Test #51:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 3 1 3 1 2 4 6 1 3 5
output:
Accepted
Test #52:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
2 3 2 2 3 2 5 1 3 6 4
output:
Accepted
Test #53:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
2 3 2 2 4 2 5 1 4 6 3
output:
Accepted
Test #54:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
2 3 1 3 2 2 5 6 1 3 4
output:
Accepted
Test #55:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
2 3 1 2 6 2 6 4 1 5 3
output:
Accepted
Test #56:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 3 1 2 3 2 6 5 1 4 3
output:
Accepted
Test #57:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
2 3 2 1 3 3 2 1 6 5 4
output:
Accepted
Test #58:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
2 3 2 2 1 3 4 1 5 6 2
output:
Accepted
Test #59:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
2 3 1 3 1 3 4 6 1 2 5
output:
Accepted
Test #60:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 3 2 2 4 3 5 1 4 6 2
output:
Accepted
Test #61:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
2 3 1 3 4 3 5 6 1 2 4
output:
Accepted
Test #62:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 3 1 2 2 3 6 4 1 5 2
output:
Accepted
Test #63:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
2 3 1 2 4 3 6 4 2 5 1
output:
Accepted
Test #64:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
2 3 1 2 5 3 6 5 1 4 2
output:
Accepted
Test #65:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 3 1 2 6 3 6 5 2 4 1
output:
Accepted
Test #66:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
2 3 2 1 1 4 2 1 6 5 3
output:
Accepted
Test #67:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 3 2 1 4 4 3 1 6 5 2
output:
Accepted
Test #68:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
2 3 1 3 1 4 5 6 1 2 3
output:
Accepted
Test #69:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
2 3 1 2 6 4 6 2 3 5 1
output:
Accepted
Test #70:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
2 3 1 2 5 4 6 3 1 5 2
output:
Accepted
Test #71:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
2 3 1 2 1 4 6 3 2 5 1
output:
Accepted
Test #72:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
2 3 1 2 2 4 6 5 1 3 2
output:
Accepted
Test #73:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
2 3 1 2 2 4 6 5 2 3 1
output:
Accepted
Test #74:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
2 3 2 1 3 5 2 1 6 4 3
output:
Accepted
Test #75:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 3 2 1 1 5 3 1 6 4 2
output:
Accepted
Test #76:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
2 3 1 2 2 5 6 2 3 4 1
output:
Accepted
Test #77:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
2 3 1 2 3 5 6 3 1 4 2
output:
Accepted
Test #78:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
2 3 1 2 1 5 6 3 2 4 1
output:
Accepted
Test #79:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
2 3 1 2 3 5 6 4 1 3 2
output:
Accepted
Test #80:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 3 1 2 1 5 6 4 2 3 1
output:
Accepted
Test #81:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
2 3 1 1 5 6 4 2 5 3 1
output:
Accepted
Test #82:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
2 3 1 1 2 6 4 3 5 2 1
output:
Accepted
Test #83:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
2 3 1 1 6 6 5 2 4 3 1
output:
Accepted
Test #84:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
2 3 1 1 3 6 5 3 4 2 1
output:
Accepted
Test #85:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
2 3 1 1 1 6 5 4 3 2 1
output:
Accepted
Test #86:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
1 3 1 3 1 1 2 3
output:
Accepted
Test #87:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
1 3 1 3 2 1 2 3
output:
Accepted
Test #88:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
1 3 1 3 3 1 2 3
output:
Accepted
Test #89:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
1 3 1 2 1 1 3 2
output:
Accepted
Test #90:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
1 3 1 2 3 1 3 2
output:
Accepted
Test #91:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
1 3 1 2 2 1 3 2
output:
Accepted
Test #92:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
1 3 1 2 2 2 3 1
output:
Accepted
Test #93:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
1 3 1 2 3 2 3 1
output:
Accepted
Test #94:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
1 3 1 2 1 2 3 1
output:
Accepted
Test #95:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
1 3 1 1 3 3 2 1
output:
Accepted
Test #96:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
1 3 1 1 2 3 2 1
output:
Accepted
Test #97:
score: 0
Accepted
time: 0ms
memory: 3960kb
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 [4]
Subtask #2:
score: 0
Skipped
Dependency #1:
0%