QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#295863#1418. Mountain Rescue Team170 1ms3724kbC++20975b2024-01-01 13:06:432024-01-01 13:06:43

Judging History

你现在查看的是最新测评结果

  • [2024-01-01 13:06:43]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3724kb
  • [2024-01-01 13:06:43]
  • 提交

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);
      }
    }
  }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 20
Accepted
time: 1ms
memory: 3608kb

input:

1 1 1 1 1
1

output:

Accepted

Test #2:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2 2 2 2 1
1 2
3 4

output:

Accepted

Test #3:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

2 2 2 2 2
1 2
3 4

output:

Accepted

Test #4:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

2 2 2 2 3
1 2
3 4

output:

Accepted

Test #5:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

2 2 2 2 4
1 2
3 4

output:

Accepted

Test #6:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2 2 2 2 1
1 3
2 4

output:

Accepted

Test #7:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

2 2 2 2 3
1 3
2 4

output:

Accepted

Test #8:

score: 0
Accepted
time: 1ms
memory: 3684kb

input:

2 2 2 2 2
1 3
2 4

output:

Accepted

Test #9:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

2 2 2 2 4
1 3
2 4

output:

Accepted

Test #10:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

2 2 2 1 2
2 1
4 3

output:

Accepted

Test #11:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2 2 2 1 1
2 1
4 3

output:

Accepted

Test #12:

score: 0
Accepted
time: 0ms
memory: 3660kb

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: 3608kb

input:

2 2 1 2 2
2 4
1 3

output:

Accepted

Test #15:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

2 2 1 2 4
2 4
1 3

output:

Accepted

Test #16:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

2 2 1 2 1
2 4
1 3

output:

Accepted

Test #17:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

2 2 1 2 3
2 4
1 3

output:

Accepted

Test #18:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

2 2 2 1 3
3 1
4 2

output:

Accepted

Test #19:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2 2 2 1 1
3 1
4 2

output:

Accepted

Test #20:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2 2 2 1 4
3 1
4 2

output:

Accepted

Test #21:

score: 0
Accepted
time: 0ms
memory: 3692kb

input:

2 2 2 1 2
3 1
4 2

output:

Accepted

Test #22:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

2 2 1 2 3
3 4
1 2

output:

Accepted

Test #23:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

2 2 1 2 4
3 4
1 2

output:

Accepted

Test #24:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2 2 1 2 1
3 4
1 2

output:

Accepted

Test #25:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

2 2 1 2 2
3 4
1 2

output:

Accepted

Test #26:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

2 2 1 1 4
4 2
3 1

output:

Accepted

Test #27:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

2 2 1 1 2
4 2
3 1

output:

Accepted

Test #28:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

2 2 1 1 3
4 2
3 1

output:

Accepted

Test #29:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

2 2 1 1 1
4 2
3 1

output:

Accepted

Test #30:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

2 2 1 1 4
4 3
2 1

output:

Accepted

Test #31:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

2 2 1 1 3
4 3
2 1

output:

Accepted

Test #32:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

2 2 1 1 2
4 3
2 1

output:

Accepted

Test #33:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

2 2 1 1 1
4 3
2 1

output:

Accepted

Test #34:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2 3 2 3 1
1 2 3
4 5 6

output:

Accepted

Test #35:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2 3 2 3 4
1 2 4
3 5 6

output:

Accepted

Test #36:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2 3 2 3 6
1 2 5
3 4 6

output:

Accepted

Test #37:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

2 3 2 2 5
1 3 2
4 6 5

output:

Accepted

Test #38:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

2 3 2 2 2
1 3 2
5 6 4

output:

Accepted

Test #39:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

2 3 2 3 5
1 3 4
2 5 6

output:

Accepted

Test #40:

score: 0
Accepted
time: 0ms
memory: 3692kb

input:

2 3 2 3 1
1 3 5
2 4 6

output:

Accepted

Test #41:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

2 3 2 2 2
1 4 2
3 6 5

output:

Accepted

Test #42:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

2 3 2 2 5
1 4 2
5 6 3

output:

Accepted

Test #43:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

2 3 2 2 5
1 4 3
2 6 5

output:

Accepted

Test #44:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

2 3 2 2 1
1 5 2
3 6 4

output:

Accepted

Test #45:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

2 3 2 2 2
1 5 2
4 6 3

output:

Accepted

Test #46:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2 3 2 2 2
1 5 3
2 6 4

output:

Accepted

Test #47:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2 3 2 2 6
2 3 1
4 6 5

output:

Accepted

Test #48:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

2 3 2 2 4
2 3 1
5 6 4

output:

Accepted

Test #49:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

2 3 2 2 6
2 4 1
3 6 5

output:

Accepted

Test #50:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2 3 2 2 4
2 4 1
5 6 3

output:

Accepted

Test #51:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

2 3 1 3 1
2 4 6
1 3 5

output:

Accepted

Test #52:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

2 3 2 2 3
2 5 1
3 6 4

output:

Accepted

Test #53:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

2 3 2 2 4
2 5 1
4 6 3

output:

Accepted

Test #54:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

2 3 1 3 2
2 5 6
1 3 4

output:

Accepted

Test #55:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2 3 1 2 6
2 6 4
1 5 3

output:

Accepted

Test #56:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

2 3 1 2 3
2 6 5
1 4 3

output:

Accepted

Test #57:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2 3 2 1 3
3 2 1
6 5 4

output:

Accepted

Test #58:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2 3 2 2 1
3 4 1
5 6 2

output:

Accepted

Test #59:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2 3 1 3 1
3 4 6
1 2 5

output:

Accepted

Test #60:

score: 0
Accepted
time: 1ms
memory: 3692kb

input:

2 3 2 2 4
3 5 1
4 6 2

output:

Accepted

Test #61:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

2 3 1 3 4
3 5 6
1 2 4

output:

Accepted

Test #62:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2 3 1 2 2
3 6 4
1 5 2

output:

Accepted

Test #63:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

2 3 1 2 4
3 6 4
2 5 1

output:

Accepted

Test #64:

score: 0
Accepted
time: 0ms
memory: 3668kb

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: 3672kb

input:

2 3 2 1 1
4 2 1
6 5 3

output:

Accepted

Test #67:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

2 3 2 1 4
4 3 1
6 5 2

output:

Accepted

Test #68:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

2 3 1 3 1
4 5 6
1 2 3

output:

Accepted

Test #69:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2 3 1 2 6
4 6 2
3 5 1

output:

Accepted

Test #70:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2 3 1 2 5
4 6 3
1 5 2

output:

Accepted

Test #71:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

2 3 1 2 1
4 6 3
2 5 1

output:

Accepted

Test #72:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2 3 1 2 2
4 6 5
1 3 2

output:

Accepted

Test #73:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

2 3 1 2 2
4 6 5
2 3 1

output:

Accepted

Test #74:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

2 3 2 1 3
5 2 1
6 4 3

output:

Accepted

Test #75:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

2 3 2 1 1
5 3 1
6 4 2

output:

Accepted

Test #76:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

2 3 1 2 2
5 6 2
3 4 1

output:

Accepted

Test #77:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

2 3 1 2 3
5 6 3
1 4 2

output:

Accepted

Test #78:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

2 3 1 2 1
5 6 3
2 4 1

output:

Accepted

Test #79:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

2 3 1 2 3
5 6 4
1 3 2

output:

Accepted

Test #80:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

2 3 1 2 1
5 6 4
2 3 1

output:

Accepted

Test #81:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

2 3 1 1 5
6 4 2
5 3 1

output:

Accepted

Test #82:

score: 0
Accepted
time: 0ms
memory: 3660kb

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: 3612kb

input:

2 3 1 1 3
6 5 3
4 2 1

output:

Accepted

Test #85:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

2 3 1 1 1
6 5 4
3 2 1

output:

Accepted

Test #86:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

1 3 1 3 1
1 2 3

output:

Accepted

Test #87:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

1 3 1 3 2
1 2 3

output:

Accepted

Test #88:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

1 3 1 3 3
1 2 3

output:

Accepted

Test #89:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

1 3 1 2 1
1 3 2

output:

Accepted

Test #90:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

1 3 1 2 3
1 3 2

output:

Accepted

Test #91:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

1 3 1 2 2
1 3 2

output:

Accepted

Test #92:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

1 3 1 2 2
2 3 1

output:

Accepted

Test #93:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

1 3 1 2 3
2 3 1

output:

Accepted

Test #94:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

1 3 1 2 1
2 3 1

output:

Accepted

Test #95:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

1 3 1 1 3
3 2 1

output:

Accepted

Test #96:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

1 3 1 1 2
3 2 1

output:

Accepted

Test #97:

score: 0
Accepted
time: 0ms
memory: 3660kb

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:

Unauthorized output

Subtask #2:

score: 0
Skipped

Dependency #1:

0%