QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#296068#1418. Mountain Rescue Team1720 4ms4232kbC++203.6kb2024-01-02 07:01:272024-01-02 07:01:28

Judging History

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

  • [2024-01-02 07:01:28]
  • 评测
  • 测评结果:20
  • 用时:4ms
  • 内存:4232kb
  • [2024-01-02 07:01:27]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
bool g = false;
template<class F>
vector<int> smawk(int h, int w, F f){
  auto dfs = [&](auto self, vector<int> &row, vector<int> &col) -> vector<int>{
    int n = row.size();
    if(n == 0) return {};
    vector<int> ncol;
    ncol.reserve(n);
    for(int i:col){
      while(!ncol.empty() && f(row[ncol.size()-1], ncol.back()) > f(row[ncol.size()-1], i)) ncol.pop_back();
      if(ncol.size() < n) ncol.push_back(i);
    }
    vector<int> row_odd;
    row_odd.reserve(n/2+1);
    for(int i = 1; i < n; i+=2) row_odd.push_back(row[i]);
    vector<int> ans = self(self, row_odd, ncol);
    vector<int> res(n);
    for(int i = 0; i < row_odd.size(); i++) res[i*2+1] = ans[i];
    int j = 0;
    for(int i = 0; i < n; i+=2){
      int last = (i == n-1 ? ncol.back() : res[i+1]);
      res[i] = ncol[j];
      while(ncol[j] < last){
        ++j;
        if(f(row[i], res[i]) > f(row[i], ncol[j])) res[i] = ncol[j];
      }
    }
    return res;
  };
  vector<int> row(h), col(w);
  iota(row.begin(), row.end(), 0);
  iota(col.begin(), col.end(), 0);
  return dfs(dfs, row, col);
}
void Rescue(int R, int C, int RS, int CS, int X){
  map<pair<int, int>, int> m;
  int l1 = 0, r1 = RS;
  while(r1-l1 > 1){
    int mid = (l1+r1)/2;
    int x = mid, y = CS;
    int h = m.count({x, y}) ? m[{x, y}] : Measure(x, y);
    if(!m.count({x, y})){
      if(h == X){
        Pinpoint(x, y);
        g = true;
      }
      m[{x, y}] = h;
    }
    if(h < X) l1 = mid;
    else r1 = mid;
  }
  int l2 = RS, r2 = R+1;
  while(r2-l2 > 1){
    int mid = (l2+r2)/2;
    int x = mid, y = CS;
    int h = m.count({x, y}) ? m[{x, y}] : Measure(x, y);
    if(!m.count({x, y})){
      if(h == X){
        Pinpoint(x, y);
        g = true;
      }
      m[{x, y}] = h;
    }
    if(h < X) r2 = mid;
    else l2 = mid;
  }
  auto f1 = [&](int x, int y){
    if(g) return 0;
    x = r1+x;
    y = CS-y;
    int h = m.count({x, y}) ? m[{x, y}] : Measure(x, y);
    if(!m.count({x, y})){
      if(h == X){
        Pinpoint(x, y);
        g = true;
      }
      m[{x, y}] = h;
    }
    return abs(h-X);
  };
  auto s1 = smawk(RS-r1+1, CS, f1);
  for(int i = 0; i < s1.size(); i++){
    cerr << s1[i] << " ";
    f1(i, s1[i]);
  }
  cerr << endl;
  auto f2 = [&](int x, int y){
    if(g) return 0;
    x = r1+x;
    y = CS+y;
    int h = m.count({x, y}) ? m[{x, y}] : Measure(x, y);
    if(!m.count({x, y})){
      if(h == X){
        Pinpoint(x, y);
        g = true;
      }
      m[{x, y}] = h;
    }
    return abs(h-X);
  };
  auto s2 = smawk(RS-r1+1, C-CS+1, f2);
  for(int i = 0; i < s2.size(); i++){
    cerr << s2[i] << " ";
    f2(i, s2[i]);
  }
  cerr << endl;
  auto f3 = [&](int x, int y){
    if(g) return 0;
    x = l2-x;
    y = CS-y;
    int h = m.count({x, y}) ? m[{x, y}] : Measure(x, y);
    if(!m.count({x, y})){
      if(h == X){
        Pinpoint(x, y);
        g = true;
      }
      m[{x, y}] = h;
    }
    return abs(h-X);
  };
  auto s3 = smawk(l2-RS+1, CS, f3);
  for(int i = 0; i < s3.size(); i++){
    cerr << s3[i] << " ";
    f3(i, s3[i]);
  }
  cerr << endl;
  auto f4 = [&](int x, int y){
    if(g) return 0;
    x = l2-x;
    y = CS+y;
    int h = m.count({x, y}) ? m[{x, y}] : Measure(x, y);
    if(!m.count({x, y})){
      if(h == X){
        Pinpoint(x, y);
        g = true;
      }
      m[{x, y}] = h;
    }
    return abs(h-X);
  };
  auto s4 = smawk(l2-RS+1, C-CS+1, f4);
  for(int i = 0; i < s4.size(); i++){
    cerr << s4[i] << " ";
    f4(i, s4[i]);
  }
  cerr << endl;
}

詳細信息

Subtask #1:

score: 20
Accepted

Test #1:

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

input:

1 1 1 1 1
1

output:

Accepted

Test #2:

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

input:

2 2 2 2 1
1 2
3 4

output:

Accepted

Test #3:

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

input:

2 2 2 2 2
1 2
3 4

output:

Accepted

Test #4:

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

input:

2 2 2 2 3
1 2
3 4

output:

Accepted

Test #5:

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

input:

2 2 2 2 4
1 2
3 4

output:

Accepted

Test #6:

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

input:

2 2 2 2 1
1 3
2 4

output:

Accepted

Test #7:

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

input:

2 2 2 2 3
1 3
2 4

output:

Accepted

Test #8:

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

input:

2 2 2 2 2
1 3
2 4

output:

Accepted

Test #9:

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

input:

2 2 2 2 4
1 3
2 4

output:

Accepted

Test #10:

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

input:

2 2 2 1 2
2 1
4 3

output:

Accepted

Test #11:

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

input:

2 2 2 1 1
2 1
4 3

output:

Accepted

Test #12:

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

input:

2 2 2 1 4
2 1
4 3

output:

Accepted

Test #13:

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

input:

2 2 2 1 3
2 1
4 3

output:

Accepted

Test #14:

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

input:

2 2 1 2 2
2 4
1 3

output:

Accepted

Test #15:

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

input:

2 2 1 2 4
2 4
1 3

output:

Accepted

Test #16:

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

input:

2 2 1 2 1
2 4
1 3

output:

Accepted

Test #17:

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

input:

2 2 1 2 3
2 4
1 3

output:

Accepted

Test #18:

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

input:

2 2 2 1 3
3 1
4 2

output:

Accepted

Test #19:

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

input:

2 2 2 1 1
3 1
4 2

output:

Accepted

Test #20:

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

input:

2 2 2 1 4
3 1
4 2

output:

Accepted

Test #21:

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

input:

2 2 2 1 2
3 1
4 2

output:

Accepted

Test #22:

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

input:

2 2 1 2 3
3 4
1 2

output:

Accepted

Test #23:

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

input:

2 2 1 2 4
3 4
1 2

output:

Accepted

Test #24:

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

input:

2 2 1 2 1
3 4
1 2

output:

Accepted

Test #25:

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

input:

2 2 1 2 2
3 4
1 2

output:

Accepted

Test #26:

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

input:

2 2 1 1 4
4 2
3 1

output:

Accepted

Test #27:

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

input:

2 2 1 1 2
4 2
3 1

output:

Accepted

Test #28:

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

input:

2 2 1 1 3
4 2
3 1

output:

Accepted

Test #29:

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

input:

2 2 1 1 1
4 2
3 1

output:

Accepted

Test #30:

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

input:

2 2 1 1 4
4 3
2 1

output:

Accepted

Test #31:

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

input:

2 2 1 1 3
4 3
2 1

output:

Accepted

Test #32:

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

input:

2 2 1 1 2
4 3
2 1

output:

Accepted

Test #33:

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

input:

2 2 1 1 1
4 3
2 1

output:

Accepted

Test #34:

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

input:

2 3 2 3 1
1 2 3
4 5 6

output:

Accepted

Test #35:

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

input:

2 3 2 3 4
1 2 4
3 5 6

output:

Accepted

Test #36:

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

input:

2 3 2 3 6
1 2 5
3 4 6

output:

Accepted

Test #37:

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

input:

2 3 2 2 5
1 3 2
4 6 5

output:

Accepted

Test #38:

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

input:

2 3 2 2 2
1 3 2
5 6 4

output:

Accepted

Test #39:

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

input:

2 3 2 3 5
1 3 4
2 5 6

output:

Accepted

Test #40:

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

input:

2 3 2 3 1
1 3 5
2 4 6

output:

Accepted

Test #41:

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

input:

2 3 2 2 2
1 4 2
3 6 5

output:

Accepted

Test #42:

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

input:

2 3 2 2 5
1 4 2
5 6 3

output:

Accepted

Test #43:

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

input:

2 3 2 2 5
1 4 3
2 6 5

output:

Accepted

Test #44:

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

input:

2 3 2 2 1
1 5 2
3 6 4

output:

Accepted

Test #45:

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

input:

2 3 2 2 2
1 5 2
4 6 3

output:

Accepted

Test #46:

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

input:

2 3 2 2 2
1 5 3
2 6 4

output:

Accepted

Test #47:

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

input:

2 3 2 2 6
2 3 1
4 6 5

output:

Accepted

Test #48:

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

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: 0ms
memory: 3996kb

input:

2 3 2 2 4
2 4 1
5 6 3

output:

Accepted

Test #51:

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

input:

2 3 1 3 1
2 4 6
1 3 5

output:

Accepted

Test #52:

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

input:

2 3 2 2 3
2 5 1
3 6 4

output:

Accepted

Test #53:

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

input:

2 3 2 2 4
2 5 1
4 6 3

output:

Accepted

Test #54:

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

input:

2 3 1 3 2
2 5 6
1 3 4

output:

Accepted

Test #55:

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

input:

2 3 1 2 6
2 6 4
1 5 3

output:

Accepted

Test #56:

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

input:

2 3 1 2 3
2 6 5
1 4 3

output:

Accepted

Test #57:

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

input:

2 3 2 1 3
3 2 1
6 5 4

output:

Accepted

Test #58:

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

input:

2 3 2 2 1
3 4 1
5 6 2

output:

Accepted

Test #59:

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

input:

2 3 1 3 1
3 4 6
1 2 5

output:

Accepted

Test #60:

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

input:

2 3 2 2 4
3 5 1
4 6 2

output:

Accepted

Test #61:

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

input:

2 3 1 3 4
3 5 6
1 2 4

output:

Accepted

Test #62:

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

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

input:

2 3 1 2 5
3 6 5
1 4 2

output:

Accepted

Test #65:

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

input:

2 3 1 2 6
3 6 5
2 4 1

output:

Accepted

Test #66:

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

input:

2 3 2 1 1
4 2 1
6 5 3

output:

Accepted

Test #67:

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

input:

2 3 2 1 4
4 3 1
6 5 2

output:

Accepted

Test #68:

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

input:

2 3 1 3 1
4 5 6
1 2 3

output:

Accepted

Test #69:

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

input:

2 3 1 2 6
4 6 2
3 5 1

output:

Accepted

Test #70:

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

input:

2 3 1 2 5
4 6 3
1 5 2

output:

Accepted

Test #71:

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

input:

2 3 1 2 1
4 6 3
2 5 1

output:

Accepted

Test #72:

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

input:

2 3 1 2 2
4 6 5
1 3 2

output:

Accepted

Test #73:

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

input:

2 3 1 2 2
4 6 5
2 3 1

output:

Accepted

Test #74:

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

input:

2 3 2 1 3
5 2 1
6 4 3

output:

Accepted

Test #75:

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

input:

2 3 2 1 1
5 3 1
6 4 2

output:

Accepted

Test #76:

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

input:

2 3 1 2 2
5 6 2
3 4 1

output:

Accepted

Test #77:

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

input:

2 3 1 2 3
5 6 3
1 4 2

output:

Accepted

Test #78:

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

input:

2 3 1 2 1
5 6 3
2 4 1

output:

Accepted

Test #79:

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

input:

2 3 1 2 3
5 6 4
1 3 2

output:

Accepted

Test #80:

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

input:

2 3 1 2 1
5 6 4
2 3 1

output:

Accepted

Test #81:

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

input:

2 3 1 1 5
6 4 2
5 3 1

output:

Accepted

Test #82:

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

input:

2 3 1 1 2
6 4 3
5 2 1

output:

Accepted

Test #83:

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

input:

2 3 1 1 6
6 5 2
4 3 1

output:

Accepted

Test #84:

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

input:

2 3 1 1 3
6 5 3
4 2 1

output:

Accepted

Test #85:

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

input:

2 3 1 1 1
6 5 4
3 2 1

output:

Accepted

Test #86:

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

input:

1 3 1 3 1
1 2 3

output:

Accepted

Test #87:

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

input:

1 3 1 3 2
1 2 3

output:

Accepted

Test #88:

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

input:

1 3 1 3 3
1 2 3

output:

Accepted

Test #89:

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

input:

1 3 1 2 1
1 3 2

output:

Accepted

Test #90:

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

input:

1 3 1 2 3
1 3 2

output:

Accepted

Test #91:

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

input:

1 3 1 2 2
1 3 2

output:

Accepted

Test #92:

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

input:

1 3 1 2 2
2 3 1

output:

Accepted

Test #93:

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

input:

1 3 1 2 3
2 3 1

output:

Accepted

Test #94:

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

input:

1 3 1 2 1
2 3 1

output:

Accepted

Test #95:

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

input:

1 3 1 1 3
3 2 1

output:

Accepted

Test #96:

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

input:

1 3 1 1 2
3 2 1

output:

Accepted

Test #97:

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

input:

1 3 1 1 1
3 2 1

output:

Accepted

Test #98:

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

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:

Accepted

Test #99:

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

input:

50 50 30 12 239615691
198970964 199588589 199827654 200750902 219606923 219768101 222958140 223147594 223617302 223840190 224107231 245397142 222507248 222238595 222148187 221502142 221355250 219019842 218910785 218657961 218456225 217727973 216183279 215567159 215528232 214995079 214744415 21399096...

output:

Accepted

Test #100:

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

input:

50 50 41 13 21803182
21803182 22640351 22822628 22842035 22894975 23150927 23421190 23742395 23950017 24530562 25184421 25554044 45850484 25366183 18819607 18078058 17557430 17211437 15920791 15757714 15518704 14686158 14175620 13414990 10725176 10590825 10305600 10052365 9972543 9859843 7873899 785...

output:

Accepted

Test #101:

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

input:

50 50 20 8 155056
574571250 574961349 575153304 575306256 575577263 576237809 582465605 639397201 604785755 604146421 604142642 603393114 594955832 594879019 594155040 593760771 593512097 592047416 591879184 572604250 571653755 571388761 571051562 568870211 568487436 567614176 559687456 533016609 51...

output:

Accepted

Test #102:

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

input:

50 50 45 25 999935938
7609752 7625163 7631120 7878829 7951071 8115401 8131117 8497608 9039215 9224294 9545277 9732654 9998969 10078344 10290169 10828976 10938478 11412418 11585381 11963084 13205216 14002190 14052095 14534900 34083989 14250584 13979860 13554720 13449661 8746380 7361264 6164259 577670...

output:

Accepted

Test #103:

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

input:

50 50 31 38 999951647
872078 18973042 43219086 63568679 88731838 112115467 131240645 154128740 154176986 154266884 154365830 154417339 154883906 155740428 156315677 156333038 156737527 161178571 162439790 162741773 163220742 163239731 164028924 164407541 164780430 164955926 165024878 165659528 16624...

output:

Accepted

Test #104:

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

input:

50 50 7 44 64599154
21642435 38271797 112724551 144785354 159618984 191818396 231314431 300812849 329090530 370154405 403175303 426954055 452992650 463720673 509222750 542006366 566038003 594205567 597363505 623893190 656051812 678631090 689778812 715870784 750079406 755618380 788154928 803575753 81...

output:

Accepted

Test #105:

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

input:

50 50 41 22 172222921
7382853 7503025 7610120 7789954 7836682 8853403 8892346 9096363 9436411 9688423 10032917 10184925 10366779 11027720 11129919 11529605 12148261 12306474 12644449 13111403 13652119 41353415 15004614 14239747 14050527 13827966 13690870 7064271 6198168 6063250 6005901 5456624 54186...

output:

Accepted

Test #106:

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

input:

50 50 31 2 630623201
361829280 418097118 386181026 385682843 385592387 382603632 382171803 377375746 377251507 377013308 376948433 374017779 373782784 373526744 373467935 373337812 373034238 372709329 372218110 372104991 371882340 371479168 371194683 370939760 370846939 370736406 370524379 370089327...

output:

Accepted

Test #107:

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

input:

50 50 27 19 945960322
107983758 108369608 108906082 119505890 120782483 121591595 121804196 122041643 122060711 122411601 122449151 122468080 123218730 134130675 134994241 135156033 135156974 135399433 164900365 136678432 136441239 135788663 134927943 126645805 126479405 125562085 125092136 12490003...

output:

Accepted

Test #108:

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

input:

50 50 1 1 74151489
999609053 999427876 998174897 996657364 995097130 991506340 986553050 981950004 978453000 969110126 961168236 955958045 947768897 935538728 929010432 920319907 905125983 892462966 871901666 858585571 841874604 825222409 813681977 800074444 782572018 763530096 740689357 720553313 6...

output:

Accepted

Test #109:

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

input:

50 50 1 1 817076
999442754 998385728 996598818 995234042 994701346 992159867 988458314 986293841 980523802 974034681 963827720 955576001 946670476 939209020 927529855 922573764 912092988 897437654 884939017 869090147 851776325 837146237 825917123 807395100 795504941 781189629 756917817 735408790 707...

output:

Accepted

Test #110:

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

input:

50 50 50 50 37137055
356142 9286596 10406533 10677699 10817578 10886601 11296437 11370283 12867319 13896530 26071652 26317350 26485534 26825632 26857116 27783648 27889829 28357026 28499822 28573363 29616393 29717810 29824731 30602099 31315907 31334806 31710745 31739570 32004671 32015471 32261751 322...

output:

Accepted

Test #111:

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

input:

50 50 50 50 244717
244717 11852143 12249478 12310754 12699277 13098057 13598275 13875402 14320613 14337307 14502515 15158325 15436689 15953636 16060414 16123294 16401909 16696489 16702362 16950809 17235853 17309680 17350958 17578858 17749291 17758160 17806002 18599588 18852895 19090822 20496916 2063...

output:

Accepted

Test #112:

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

input:

50 50 1 50 108125183
69545237 108178399 135974614 178621204 213615496 256605544 294248678 332222572 363128778 397516484 430598455 460285707 491818514 513661337 541886025 567248989 590130647 615431522 641951026 664353983 683813118 695742893 725361065 742929129 761378385 778452808 795267779 815140137 ...

output:

Accepted

Test #113:

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

input:

50 50 1 50 317894
76528013 115626424 163743895 197181898 231252223 267928982 293612154 328354634 357473243 389807050 416942810 449206178 472829758 501789299 529184297 557130006 588238557 616712855 639287098 664928627 683865638 706204115 731018297 748330468 761888986 786292411 802648740 825656126 842...

output:

Accepted

Test #114:

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

input:

50 50 50 1 39569954
82407849 41648402 41261452 40696045 40175766 40071400 25042733 24504306 24480937 24045745 24019817 23805132 23193581 23062925 23011469 22560275 21950200 20860459 20581553 20204690 20190381 19304461 19280530 19197119 19111563 18668422 18304735 18141972 16746523 16430448 15190511 1...

output:

Accepted

Test #115:

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

input:

50 50 50 1 750911
72838504 36190804 35399778 35179334 34960854 34695247 34420165 34002616 33749492 33170131 33117502 32823566 32188298 31594526 31378396 31018884 30919527 29453381 28953382 28115822 28066205 28017839 27748135 27302823 27012095 26799236 26773136 26324614 26175546 26006100 24462825 244...

output:

Accepted

Test #116:

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

input:

50 50 25 50 980382992
448354 20407125 50410541 67944688 84480177 99313247 127478567 153156382 166652223 182095890 196234273 222209995 242705960 262377812 283596302 292448983 315829192 333572488 353189446 373546898 396345831 423087476 441314861 461450129 503097940 513142970 532151880 532713643 532870...

output:

Accepted

Test #117:

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

input:

50 50 50 25 59755862
14700979 15102364 15219537 15826552 15877599 16498063 16930197 16999885 17106399 17237536 18251611 18787663 18961417 19505817 19620064 19718852 19850365 19886838 20320484 20758804 20997660 21529015 22665984 22967881 44674241 14361370 14322890 13005570 12888155 12707974 12485436 ...

output:

Accepted

Test #118:

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

input:

1 50 1 50 42230506
42230506 55128319 65340093 114610664 138718450 207917151 210893593 211240113 244908523 315789147 348049618 361866095 371885953 381401083 409275860 471625499 487059354 525539376 531040079 561897527 562985720 571298388 586468518 624329625 647832840 653967292 693837485 702892895 7068...

output:

Accepted

Test #119:

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

input:

1 50 1 50 634567935
46849593 83402330 104306494 104442532 134704802 167543801 179142389 181180418 193426703 206285405 215352586 219797271 237732831 278480881 304666790 319991661 327860511 367015786 409558977 477702191 489989808 499028964 525648688 534717581 538381438 540678733 546056295 625558513 63...

output:

Accepted

Test #120:

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

input:

1 50 1 50 996100886
16967584 48140976 49006030 73147388 88059446 98578200 123657548 135664971 141633406 156384551 186136461 192857556 212349827 243288827 262833403 299180607 335055436 337354563 339522833 367315355 419001546 433295152 434856476 435561019 445467909 476516076 477821810 495829026 504587...

output:

Accepted

Test #121:

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

input:

50 1 50 1 55532192
55532192
55545058
74706951
100598458
112793505
123409428
135940917
142181486
144257282
158230135
163835464
170988781
182752857
231160118
235188793
259304035
273898675
289930031
292035680
353373298
388237461
400983392
489538950
510484858
559464608
561492448
574926929
584256420
5871...

output:

Accepted

Test #122:

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

input:

50 1 50 1 547797520
38254633
55250015
90801115
106029819
118034479
137684564
144427938
151634820
157671696
197258273
224232366
253829171
291284023
325788722
401794871
402158196
409183592
448409589
460594881
462250111
467896768
476895906
486639157
547797520
551441653
598626180
607464278
621220282
625...

output:

Accepted

Test #123:

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

input:

50 1 50 1 971336438
37723731
72649198
73422563
74237493
120508538
125128444
129284518
147800751
188125486
195389522
224848948
228087661
257968521
258503562
293879503
323339895
332907443
360910812
374830909
376121080
382421477
407912357
415219479
467993306
469288649
469472630
501184015
508183757
5311...

output:

Accepted

Test #124:

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

input:

50 50 50 50 900002451
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 900000050
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 9...

output:

Accepted

Test #125:

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

input:

50 50 50 1 900002451
2402 2353 2304 2255 2206 2157 2108 2059 2010 1961 1912 1863 1814 1765 1716 1667 1618 1569 1520 1471 1422 1373 1324 1275 1226 1177 1128 1079 1030 981 932 883 834 785 736 687 638 589 540 491 442 393 344 295 246 197 148 99 50 1
2403 2354 2305 2256 2207 2158 2109 2060 2011 1962 1913...

output:

Accepted

Test #126:

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

input:

50 50 1 1 900002451
900002451 2450 2449 2448 2447 2446 2445 2444 2443 2442 2441 2440 2439 2438 2437 2436 2435 2434 2433 2432 2431 2430 2429 2428 2427 2426 2425 2424 2423 2422 2421 2420 2419 2418 2417 2416 2415 2414 2413 2412 2411 2410 2409 2408 2407 2406 2405 2404 2403 2402
900002402 2401 2400 2399 ...

output:

Accepted

Test #127:

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

input:

50 50 1 50 900002451
900000050 900000099 900000148 900000197 900000246 900000295 900000344 900000393 900000442 900000491 900000540 900000589 900000638 900000687 900000736 900000785 900000834 900000883 900000932 900000981 900001030 900001079 900001128 900001177 900001226 900001275 900001324 900001373...

output:

Accepted

Test #128:

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

input:

14 16 13 5 345853273
3628141 12987529 61846219 62180055 165524100 58701774 56602834 53710058 47073748 46286302 40741136 39427814 36396469 35012453 19529557 16459918
100768216 104749076 164286853 171061023 261468026 166647989 165848242 164051130 164023950 163007820 97948018 94446908 91054606 82235273...

output:

Accepted

Test #129:

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

input:

31 27 26 11 554641252
19063221 19120586 19568537 21030198 21636207 22589199 24865397 24945108 25564705 28355218 63732943 28211215 26207194 18032208 12936366 10554038 10483550 10350552 9973139 7597794 7039231 6604357 6166135 1983601 1728550 1253528 877170
29925984 32936166 33470030 33931916 39245734 ...

output:

Accepted

Test #130:

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

input:

37 14 36 1 741333356
50759686 24205756 22610840 18859105 15624795 15048908 14214625 10669503 9330072 8997267 4976766 3947614 3687194 2618947
79547289 48989348 48112399 46077386 42495556 40086483 39819037 38841410 38456938 35640643 32993285 32920840 31792366 29159674
92446040 79497769 76779990 732809...

output:

Accepted

Test #131:

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

input:

10 45 2 31 964712464
8373703 45751341 59690081 94530354 96295857 124592102 151073179 178776885 205312626 209753843 245242619 246856112 276948252 296374358 321367395 335635253 373233286 384829307 437743845 510649443 558894339 584123198 684101161 736734384 810972602 847920806 907712786 946709888 94935...

output:

Accepted

Test #132:

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

input:

39 10 16 7 222928891
166160929 167032976 179875629 182183000 182327051 182915098 216498871 187008012 182402496 177716093
189377451 195161061 207694287 215888765 225762522 227267388 305646042 205844933 198735859 195321018
240758163 243834285 244271040 248238361 251818823 263887882 344123985 277396860...

output:

Accepted

Test #133:

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

input:

34 33 7 18 948996911
314004589 356701067 430461981 484986840 549406445 596414770 652359925 683068717 760651060 776327613 814145065 855279539 855539907 856267212 858666259 859462071 861505386 915305666 878249494 876595739 875685277 875025694 874187895 850022325 813448168 802302498 749690216 714209766...

output:

Accepted

Test #134:

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

input:

13 45 2 14 690151044
440799717 467768837 569473340 635606448 727713491 781546772 800791772 878063314 901224797 925948232 943787126 979068334 985673317 994625481 991560527 985009155 957643562 911493611 882417189 852520873 811350936 740646199 719556804 651487734 589892186 451927587 451556884 406586458...

output:

Accepted

Test #135:

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

input:

4 35 2 28 586502144
24444597 31797514 34267675 73423881 119351228 129964317 136502715 207570622 228847409 252872963 291202987 302639025 349527385 398049017 401306911 456200123 460894160 491450320 501266711 521657522 561742686 622887530 696283189 815078424 836100095 943850894 944926691 984792955 9830...

output:

Accepted

Test #136:

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

input:

50 28 1 9 467618621
919637458 947485656 953085057 973747949 985709787 990219147 997182325 999824835 999832851 998351652 997985775 991389259 984931775 976905739 962915131 947320444 926502885 910498293 879483658 861763994 835637447 811946118 786246788 758993477 728233131 702302796 670176101 639940846
...

output:

Accepted

Test #137:

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

input:

7 19 7 4 185240372
515281702 554209351 555886458 648504228 539746659 536350648 529841771 506822316 494397029 474824882 430711443 361535049 312466772 243647072 205627923 181335144 139496429 82870032 3210424
573920027 627232626 671675454 765914306 674091255 613559772 612973225 600992842 593339544 4841...

output:

Accepted

Subtask #2:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Test #138:

score: 80
Accepted
time: 3ms
memory: 3952kb

input:

200 200 115 96 972862550
23298 51506 84932 95921 130970 131061 142211 152623 175006 195115 218510 245329 272564 276739 290672 304467 312857 351570 351740 351890 365406 388503 396342 424456 439419 442240 456166 459441 462456 483704 488390 497136 501434 527250 527830 528924 533204 536070 541198 604753...

output:

Accepted

Test #139:

score: 0
Accepted
time: 3ms
memory: 4188kb

input:

200 200 144 137 420657220
27045 120184 121383 124646 138251 159026 198518 259909 283763 284580 304365 320988 387264 396721 410512 412931 505188 510201 524245 529370 570124 592164 595673 607770 619721 622468 645567 681373 695138 723606 733323 777575 795251 796618 807277 852652 866858 894818 914473 98...

output:

Accepted

Test #140:

score: 0
Accepted
time: 3ms
memory: 3976kb

input:

200 200 182 92 880614098
570211 576393 636833 661116 662654 695012 696753 717286 762629 833323 861686 874063 903466 908548 995838 1024816 1031161 1038443 1052771 1054182 1085287 1097965 1104517 1122167 1157734 1183964 1184969 1199259 1221234 1221357 1228972 1255055 1255951 1280308 1292186 1293857 12...

output:

Accepted

Test #141:

score: 0
Accepted
time: 3ms
memory: 3920kb

input:

200 200 148 54 853209734
8884 10810 41186 41394 51714 82523 99434 100741 106780 154930 166715 181075 186515 205259 211877 277904 283202 310022 352988 356824 368630 381707 450795 470824 480842 537636 564681 579179 586958 610197 616454 620635 637821 640626 660902 736590 781177 793960 855714 885220 928...

output:

Accepted

Test #142:

score: 0
Accepted
time: 4ms
memory: 4232kb

input:

200 200 23 93 73770628
468755528 480050508 493327566 502010718 510386611 521759852 537811160 546662966 554983411 566025938 571449984 586139452 592327715 599019795 612402038 618222663 622252747 634496181 645003333 647629914 659432426 668888432 678782301 684930393 693943023 702424522 707901866 7134477...

output:

Accepted

Test #143:

score: 0
Accepted
time: 4ms
memory: 3944kb

input:

200 200 22 150 965962915
152139695 157631833 168919796 178545607 186948203 194293073 202880331 208469896 221140288 227176212 238109516 246386164 253295043 263270751 272268989 279104837 285161456 294992058 301478636 311362174 316210483 324849375 337045607 345319979 352703057 357861914 366614736 37432...

output:

Accepted

Test #144:

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

input:

200 200 77 54 637414106
504294159 504299992 504370995 504372910 504391459 504422021 504430716 504432521 504457008 504504929 504510339 504512253 504524028 504532012 504540563 504546076 504574655 504600183 504617305 504636482 504685595 504691093 509540721 509601568 509915573 509920276 509925852 509926...

output:

Accepted

Test #145:

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

input:

200 200 19 25 12264313
951600299 953442099 957378883 958703473 962769764 966081760 967309436 968496148 968505213 968522921 968578108 968598710 969863059 969903128 969921023 969934979 969936326 969939215 969941482 969964428 970013385 970058600 970204446 970314964 973156252 970144531 969793099 9697844...

output:

Accepted

Test #146:

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

input:

200 200 93 198 345263816
17252 5083619 10491466 15050013 21648126 23814872 29123543 35475207 41828426 44315017 52124473 57392356 60121079 65499940 70559447 76541456 80053696 85009482 90660842 95284155 100229491 104778253 113216823 115593929 120431710 125110851 132361199 136259540 139897121 144672838...

output:

Accepted

Test #147:

score: 0
Accepted
time: 3ms
memory: 4188kb

input:

200 200 100 48 400174103
274331072 274348409 274463401 274469374 274471823 274482470 274525997 274531421 274538488 274545925 274583108 274589994 274628973 274658974 274665123 274726030 276849038 276877692 276879705 276879793 276901828 276949778 276960593 276961174 276962717 276983132 276994734 27699...

output:

Accepted

Test #148:

score: -80
Runtime Error

input:

200 200 72 164 741441176
15523 4694128 9819725 17838304 19491106 24565370 30088553 34719888 42341003 44190413 51666254 57273486 59319518 67505486 72552311 74591157 82473903 87118676 89044137 95262294 99337634 106403137 112303917 114171898 120466197 125068978 129410530 134558438 138108386 145320579 1...

output:

Wrong Answer [2]