Submission #791909

# Submission time Handle Problem Language Result Execution time Memory
791909 2023-07-24T12:27:36 Z cig32 Maze (JOI23_ho_t3) C++17
43 / 100
2000 ms 1358636 KB
#include "bits/stdc++.h"
using namespace std;
//#define int long long
const int MAXN = 2.7e7 + 10;
const int MOD = 1e9 + 7;
mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
int rnd(int x, int y) {
  int u = uniform_int_distribution<int>(x, y)(rng); return u;
}
int bm(int b, int p) {
  if(p==0) return 1 % MOD;
  int r = bm(b, p >> 1);
  if(p&1) return (((r*r) % MOD) * b) % MOD;
  return (r*r) % MOD;
}
int inv(int b) { 
  return bm(b, MOD-2);
}
int fastlog(int x) {
  return (x == 0 ? -1 : 64 - __builtin_clzll(x) - 1);
}
void printcase(int i) { cout << "Case #" << i << ": "; }
int r,c,n,sr,sc,gr,gc;
vector<vector<char>>a;
vector<int>adj[MAXN];
int dist[MAXN];
bool vis[MAXN];
int nxt;
int f(int i, int j) {
  return i*c+j;
}
void solve(int tc) {
  for(int i=0; i<MAXN; i++) dist[i] = 1e9;
  cin>>r>>c>>n;
  cin>>sr>>sc;
  cin>>gr>>gc;
  sr--,sc--,gr--,gc--;
  a.resize(r);
  for(int i=0;i<r;i++){
    a[i].resize(c);
    for(int j=0;j<c;j++){
      cin>>a[i][j];
    }
  }
  for(int i=0;i<r;i++){
    for(int j=0;j+1<c;j++){
      if(a[i][j]=='.'&&a[i][j+1]=='.'){
        adj[f(i,j)].push_back(f(i,j+1));
        adj[f(i,j+1)].push_back(f(i,j));
      }
    }
  }
  for(int i=0;i+1<r;i++){
    for(int j=0;j<c;j++){
      if(a[i][j]=='.'&&a[i+1][j]=='.'){
        adj[f(i,j)].push_back(f(i+1,j));
        adj[f(i+1,j)].push_back(f(i,j));
      }
    }
  }
  //pt3
  for(int i=0;i<r;i++){
    for(int j=0;j<c;j++){
      if(i%n != n-1 && i+1 < r) {
        adj[f(2*r+i, j)].push_back(f(2*r+i+1, j));
        adj[f(6*r+i, j)].push_back(f(6*r+i+1, j));
      }
      if(j%n != n-1 && j+1 < c) {
        adj[f(2*r+i, j)].push_back(f(2*r+i, j+1));
        adj[f(6*r+i, j)].push_back(f(6*r+i, j+1));
      }
    }
  }
  for(int i=0;i<r;i++){
    for(int j=0;j<c;j++){
      if(i%n != n-1 && i+1 < r) {
        adj[f(3*r+i, j)].push_back(f(3*r+i+1, j));
        adj[f(7*r+i, j)].push_back(f(7*r+i+1, j));
      }
      if(j%n != 0 && j-1 >= 0) {
        adj[f(3*r+i, j)].push_back(f(3*r+i, j-1));
        adj[f(7*r+i, j)].push_back(f(7*r+i, j-1));
      }
    }
  }
  for(int i=0;i<r;i++){
    for(int j=0;j<c;j++){
      if(i%n != 0 && i-1 >= 0) {
        adj[f(4*r+i, j)].push_back(f(4*r+i-1, j));
        adj[f(8*r+i, j)].push_back(f(8*r+i-1, j));
      }
      if(j%n != 0 && j-1 >= 0) {
        adj[f(4*r+i, j)].push_back(f(4*r+i, j-1));
        adj[f(8*r+i, j)].push_back(f(8*r+i, j-1));
      }
    }
  }
  for(int i=0;i<r;i++){
    for(int j=0;j<c;j++){
      if(i%n != 0 && i-1 >= 0) {
        adj[f(5*r+i, j)].push_back(f(5*r+i-1, j));
        adj[f(9*r+i, j)].push_back(f(9*r+i-1, j));
      }
      if(j%n != n-1 && j+1 < c) {
        adj[f(5*r+i, j)].push_back(f(5*r+i, j+1));
        adj[f(9*r+i, j)].push_back(f(9*r+i, j+1));
      }
    }
  }
  for(int i=2;i<6;i++){
    for(int j=0;j<r*c;j++){
      adj[j].push_back(i*r*c+j);
    }
  }
  for(int i=6;i<10;i++){
    for(int j=0;j<r*c;j++){
      adj[i*r*c+j].push_back(j);
    }
  }
  for(int i=0;i+n-1<r;i++){
    for(int j=0;j+n-1<c;j++){
      adj[f(r+i,j)].push_back(f(6*r+i,j));
      adj[f(4*r+i,j)].push_back(f(r+i,j));
      if(j%n!=0) {
        adj[f(r+i,j)].push_back(f(7*r+i,j+n-1));
        adj[f(5*r+i,j+n-1)].push_back(f(r+i,j));
      }
      if(i%n!=0) {
        adj[f(r+i,j)].push_back(f(9*r+i+n-1,j));
        adj[f(3*r+i+n-1,j)].push_back(f(r+i,j));
      }
      if(i%n!=0 && j%n!=0) {
        adj[f(r+i,j)].push_back(f(8*r+i+n-1,j+n-1));
        adj[f(2*r+i+n-1,j+n-1)].push_back(f(r+i,j));
      }
    }
  }
  //pt2
  for(int i=0;i+n-1<r;i++){
    for(int j=0;j+n-1<c;j++){
      for(int k=-n+1;k<n;k+=n-1){
        if(i+k>=0 && i+k<r && j>=n) adj[f(r+i,j)].push_back(f(r+i+k,j-n));
        if(i+k>=0 && i+k<r && j+n<c) adj[f(r+i,j)].push_back(f(r+i+k,j+n));
        if(j+k>=0 && i>=n && j+k<c) adj[f(r+i,j)].push_back(f(r+i-n,j+k));
        if(j+k>=0 && i+n<r && j+k<c) adj[f(r+i,j)].push_back(f(r+i+n,j+k));
        if(k==n-1)break;
      }
    }
  }
  for(int i=0;i<r;i++){
    for(int j=0;j<c;j++){
      if(j%n!=n-1 && j+1<c) {
        adj[f(10*r+i,j)].push_back(f(10*r+i,j+1));
        adj[f(11*r+i,j+1)].push_back(f(11*r+i,j));
        adj[f(14*r+i,j)].push_back(f(14*r+i,j+1));
        adj[f(15*r+i,j+1)].push_back(f(15*r+i,j));
      }
      if(i%n!=n-1 && i+1<r){
        adj[f(12*r+i,j)].push_back(f(12*r+i+1,j));
        adj[f(13*r+i+1,j)].push_back(f(13*r+i,j));
        adj[f(16*r+i,j)].push_back(f(16*r+i+1,j));
        adj[f(17*r+i+1,j)].push_back(f(17*r+i,j));
      }
      if(a[i][j]=='.') {
        adj[f(14*r+i,j)].push_back(f(i,j));
        adj[f(15*r+i,j)].push_back(f(i,j));
        adj[f(16*r+i,j)].push_back(f(i,j));
        adj[f(17*r+i,j)].push_back(f(i,j));
        adj[f(i,j)].push_back(f(10*r+i,j));
        adj[f(i,j)].push_back(f(11*r+i,j));
        adj[f(i,j)].push_back(f(12*r+i,j));
        adj[f(i,j)].push_back(f(13*r+i,j));
      }
    }
  }
  for(int i=0;i+n-1<r;i++){
    for(int j=0;j+n-1<c;j++){
      if(j>0) {
        adj[f(r+i,j)].push_back(f(16*r+i,j-1));
        adj[f(r+i,j)].push_back(f(17*r+i+n-1,j-1));
        adj[f(12*r+i+n-1,j-1)].push_back(f(r+i,j));
        adj[f(13*r+i,j-1)].push_back(f(r+i,j));
      }
      if(j+n<c) {
        adj[f(r+i,j)].push_back(f(16*r+i,j+n));
        adj[f(r+i,j)].push_back(f(17*r+i+n-1,j+n));
        adj[f(12*r+i+n-1,j+n)].push_back(f(r+i,j));
        adj[f(13*r+i,j+n)].push_back(f(r+i,j));
      }
      if(i>0) {
        adj[f(r+i,j)].push_back(f(14*r+i-1,j));
        adj[f(r+i,j)].push_back(f(15*r+i-1,j+n-1));
        adj[f(10*r+i-1,j+n-1)].push_back(f(r+i,j));
        adj[f(11*r+i-1,j)].push_back(f(r+i,j));
      }
      if(i+n<r) {
        adj[f(r+i,j)].push_back(f(14*r+i+n,j));
        adj[f(r+i,j)].push_back(f(15*r+i+n,j+n-1));
        adj[f(10*r+i+n,j+n-1)].push_back(f(r+i,j));
        adj[f(11*r+i+n,j)].push_back(f(r+i,j));
      }
    }
  }
  
  queue<int> q[2];
  q[0].push(f(sr, sc));
  int tar = f(gr, gc);
  dist[f(sr, sc)]=0;
  //unordered_map<int, int> prv;
  while(q[0].size() || q[1].size()) {
    for(int i=0; i<2; i++) {
      if(q[i].size()) {
        int f = q[i].front(); q[i].pop();
        if(f == tar) {
          /*
          int bruh = f;
          stack<int>stk;
          while(bruh != sr*c+sc) {
            stk.push(bruh);
            bruh=prv[bruh];
          }
          stk.push(sr*c+sc);
          while(stk.size()){
            int x=stk.top();
            cout<<x/(r*c)<<' '<<(x%(r*c))/c<<' '<<(x%(r*c))%c<<'\n';
            stk.pop();
          }
          cout<<'\n';
          */
          cout << dist[f] << '\n'; return;
        }
        if(!vis[f]) {
          vis[f] = 1;
          for(int x: adj[f]) {
            if(!vis[x] && dist[x] > dist[f] + (x >= r*c && x < 2*r*c)) {
              dist[x] = dist[f] + (x >= r*c && x < 2*r*c);
             // prv[x] = f;
              if(x >= r*c && x < 2*r*c) q[1].push(x);
              else q[0].push(x);
            }
          }
        }
        break;
      }
    }
  }
  
  
 
}
int32_t main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int t = 1; //cin >> t;
  for(int i=1; i<=t; i++) solve(i);
}
// 勿忘初衷
/*
8 9 5
3 1
2 9
.#..###.#
##..#.##.
.###..#.#
#.....##.
..###....
#......##
.##.#.###
#.##.###.
*/
# Verdict Execution time Memory Grader output
1 Correct 328 ms 740012 KB Output is correct
2 Correct 373 ms 740028 KB Output is correct
3 Correct 324 ms 740404 KB Output is correct
4 Correct 334 ms 740536 KB Output is correct
5 Correct 331 ms 740428 KB Output is correct
6 Correct 328 ms 740432 KB Output is correct
7 Correct 357 ms 740412 KB Output is correct
8 Correct 333 ms 740276 KB Output is correct
9 Correct 342 ms 739976 KB Output is correct
10 Correct 334 ms 740024 KB Output is correct
11 Correct 331 ms 739960 KB Output is correct
12 Correct 333 ms 739952 KB Output is correct
13 Correct 350 ms 740044 KB Output is correct
14 Correct 327 ms 740172 KB Output is correct
15 Correct 371 ms 740124 KB Output is correct
16 Correct 329 ms 740428 KB Output is correct
17 Correct 341 ms 740536 KB Output is correct
18 Correct 338 ms 740476 KB Output is correct
19 Correct 421 ms 764960 KB Output is correct
20 Correct 380 ms 754540 KB Output is correct
21 Correct 486 ms 774452 KB Output is correct
22 Correct 556 ms 768512 KB Output is correct
23 Correct 438 ms 764572 KB Output is correct
24 Correct 402 ms 768908 KB Output is correct
25 Correct 384 ms 758584 KB Output is correct
26 Correct 421 ms 769240 KB Output is correct
27 Correct 411 ms 768300 KB Output is correct
28 Correct 456 ms 764724 KB Output is correct
29 Correct 580 ms 802592 KB Output is correct
30 Correct 426 ms 768900 KB Output is correct
31 Correct 721 ms 826432 KB Output is correct
32 Correct 666 ms 811440 KB Output is correct
33 Correct 575 ms 801400 KB Output is correct
34 Correct 550 ms 812476 KB Output is correct
35 Correct 445 ms 786872 KB Output is correct
36 Correct 644 ms 814156 KB Output is correct
37 Correct 641 ms 811416 KB Output is correct
38 Correct 509 ms 801672 KB Output is correct
39 Execution timed out 2152 ms 1358636 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 379 ms 740036 KB Output is correct
2 Correct 379 ms 740044 KB Output is correct
3 Correct 372 ms 739988 KB Output is correct
4 Correct 354 ms 740112 KB Output is correct
5 Correct 368 ms 740388 KB Output is correct
6 Correct 362 ms 740048 KB Output is correct
7 Correct 352 ms 740036 KB Output is correct
8 Correct 364 ms 740168 KB Output is correct
9 Correct 361 ms 740580 KB Output is correct
10 Correct 375 ms 740544 KB Output is correct
11 Correct 365 ms 740400 KB Output is correct
12 Correct 363 ms 740628 KB Output is correct
13 Correct 364 ms 740512 KB Output is correct
14 Correct 358 ms 740576 KB Output is correct
15 Correct 360 ms 740524 KB Output is correct
16 Correct 391 ms 740312 KB Output is correct
17 Correct 405 ms 740556 KB Output is correct
18 Correct 379 ms 740024 KB Output is correct
19 Correct 396 ms 740540 KB Output is correct
20 Correct 364 ms 740168 KB Output is correct
21 Correct 357 ms 740008 KB Output is correct
22 Correct 369 ms 740408 KB Output is correct
23 Correct 363 ms 740128 KB Output is correct
24 Correct 366 ms 740064 KB Output is correct
25 Correct 372 ms 740136 KB Output is correct
26 Correct 372 ms 740096 KB Output is correct
27 Correct 375 ms 740004 KB Output is correct
28 Correct 373 ms 740648 KB Output is correct
29 Correct 361 ms 740044 KB Output is correct
30 Correct 371 ms 740536 KB Output is correct
31 Correct 368 ms 740420 KB Output is correct
32 Correct 357 ms 740484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 377 ms 739944 KB Output is correct
2 Correct 365 ms 740064 KB Output is correct
3 Correct 370 ms 739956 KB Output is correct
4 Correct 354 ms 740044 KB Output is correct
5 Correct 369 ms 739940 KB Output is correct
6 Correct 359 ms 740092 KB Output is correct
7 Correct 379 ms 740636 KB Output is correct
8 Correct 362 ms 740532 KB Output is correct
9 Correct 376 ms 740628 KB Output is correct
10 Correct 363 ms 740600 KB Output is correct
11 Correct 366 ms 740572 KB Output is correct
12 Correct 358 ms 740480 KB Output is correct
13 Correct 350 ms 740080 KB Output is correct
14 Correct 360 ms 740536 KB Output is correct
15 Correct 355 ms 739956 KB Output is correct
16 Correct 401 ms 740412 KB Output is correct
17 Correct 357 ms 740108 KB Output is correct
18 Correct 365 ms 740008 KB Output is correct
19 Correct 390 ms 739988 KB Output is correct
20 Correct 374 ms 740092 KB Output is correct
21 Correct 363 ms 740440 KB Output is correct
22 Correct 391 ms 740468 KB Output is correct
23 Correct 386 ms 740448 KB Output is correct
24 Correct 363 ms 741344 KB Output is correct
25 Correct 453 ms 765152 KB Output is correct
26 Correct 523 ms 777804 KB Output is correct
27 Correct 506 ms 774516 KB Output is correct
28 Correct 480 ms 775280 KB Output is correct
29 Correct 449 ms 773508 KB Output is correct
30 Correct 460 ms 772688 KB Output is correct
31 Correct 485 ms 773764 KB Output is correct
32 Correct 455 ms 769212 KB Output is correct
33 Correct 476 ms 768180 KB Output is correct
34 Correct 862 ms 820528 KB Output is correct
35 Correct 712 ms 826428 KB Output is correct
36 Correct 776 ms 828388 KB Output is correct
37 Correct 773 ms 824128 KB Output is correct
38 Correct 703 ms 821476 KB Output is correct
39 Execution timed out 2130 ms 1047988 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 379 ms 740036 KB Output is correct
2 Correct 379 ms 740044 KB Output is correct
3 Correct 372 ms 739988 KB Output is correct
4 Correct 354 ms 740112 KB Output is correct
5 Correct 368 ms 740388 KB Output is correct
6 Correct 362 ms 740048 KB Output is correct
7 Correct 352 ms 740036 KB Output is correct
8 Correct 364 ms 740168 KB Output is correct
9 Correct 361 ms 740580 KB Output is correct
10 Correct 375 ms 740544 KB Output is correct
11 Correct 365 ms 740400 KB Output is correct
12 Correct 363 ms 740628 KB Output is correct
13 Correct 364 ms 740512 KB Output is correct
14 Correct 358 ms 740576 KB Output is correct
15 Correct 360 ms 740524 KB Output is correct
16 Correct 391 ms 740312 KB Output is correct
17 Correct 405 ms 740556 KB Output is correct
18 Correct 379 ms 740024 KB Output is correct
19 Correct 396 ms 740540 KB Output is correct
20 Correct 364 ms 740168 KB Output is correct
21 Correct 357 ms 740008 KB Output is correct
22 Correct 369 ms 740408 KB Output is correct
23 Correct 363 ms 740128 KB Output is correct
24 Correct 366 ms 740064 KB Output is correct
25 Correct 372 ms 740136 KB Output is correct
26 Correct 372 ms 740096 KB Output is correct
27 Correct 375 ms 740004 KB Output is correct
28 Correct 373 ms 740648 KB Output is correct
29 Correct 361 ms 740044 KB Output is correct
30 Correct 371 ms 740536 KB Output is correct
31 Correct 368 ms 740420 KB Output is correct
32 Correct 357 ms 740484 KB Output is correct
33 Correct 451 ms 765036 KB Output is correct
34 Correct 361 ms 741232 KB Output is correct
35 Correct 368 ms 742092 KB Output is correct
36 Correct 442 ms 765184 KB Output is correct
37 Correct 401 ms 754560 KB Output is correct
38 Correct 516 ms 777696 KB Output is correct
39 Correct 496 ms 774516 KB Output is correct
40 Correct 459 ms 768504 KB Output is correct
41 Correct 476 ms 764532 KB Output is correct
42 Correct 490 ms 775412 KB Output is correct
43 Correct 458 ms 773396 KB Output is correct
44 Correct 465 ms 772652 KB Output is correct
45 Correct 447 ms 768876 KB Output is correct
46 Correct 407 ms 758756 KB Output is correct
47 Correct 460 ms 770636 KB Output is correct
48 Correct 510 ms 773580 KB Output is correct
49 Correct 516 ms 773828 KB Output is correct
50 Correct 530 ms 773868 KB Output is correct
51 Correct 526 ms 773884 KB Output is correct
52 Correct 458 ms 769280 KB Output is correct
53 Correct 438 ms 768268 KB Output is correct
54 Correct 476 ms 764608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 379 ms 740036 KB Output is correct
2 Correct 379 ms 740044 KB Output is correct
3 Correct 372 ms 739988 KB Output is correct
4 Correct 354 ms 740112 KB Output is correct
5 Correct 368 ms 740388 KB Output is correct
6 Correct 362 ms 740048 KB Output is correct
7 Correct 352 ms 740036 KB Output is correct
8 Correct 364 ms 740168 KB Output is correct
9 Correct 361 ms 740580 KB Output is correct
10 Correct 375 ms 740544 KB Output is correct
11 Correct 365 ms 740400 KB Output is correct
12 Correct 363 ms 740628 KB Output is correct
13 Correct 364 ms 740512 KB Output is correct
14 Correct 358 ms 740576 KB Output is correct
15 Correct 360 ms 740524 KB Output is correct
16 Correct 391 ms 740312 KB Output is correct
17 Correct 405 ms 740556 KB Output is correct
18 Correct 379 ms 740024 KB Output is correct
19 Correct 396 ms 740540 KB Output is correct
20 Correct 364 ms 740168 KB Output is correct
21 Correct 357 ms 740008 KB Output is correct
22 Correct 369 ms 740408 KB Output is correct
23 Correct 363 ms 740128 KB Output is correct
24 Correct 366 ms 740064 KB Output is correct
25 Correct 372 ms 740136 KB Output is correct
26 Correct 372 ms 740096 KB Output is correct
27 Correct 375 ms 740004 KB Output is correct
28 Correct 373 ms 740648 KB Output is correct
29 Correct 361 ms 740044 KB Output is correct
30 Correct 371 ms 740536 KB Output is correct
31 Correct 368 ms 740420 KB Output is correct
32 Correct 357 ms 740484 KB Output is correct
33 Correct 451 ms 765036 KB Output is correct
34 Correct 361 ms 741232 KB Output is correct
35 Correct 368 ms 742092 KB Output is correct
36 Correct 442 ms 765184 KB Output is correct
37 Correct 401 ms 754560 KB Output is correct
38 Correct 516 ms 777696 KB Output is correct
39 Correct 496 ms 774516 KB Output is correct
40 Correct 459 ms 768504 KB Output is correct
41 Correct 476 ms 764532 KB Output is correct
42 Correct 490 ms 775412 KB Output is correct
43 Correct 458 ms 773396 KB Output is correct
44 Correct 465 ms 772652 KB Output is correct
45 Correct 447 ms 768876 KB Output is correct
46 Correct 407 ms 758756 KB Output is correct
47 Correct 460 ms 770636 KB Output is correct
48 Correct 510 ms 773580 KB Output is correct
49 Correct 516 ms 773828 KB Output is correct
50 Correct 530 ms 773868 KB Output is correct
51 Correct 526 ms 773884 KB Output is correct
52 Correct 458 ms 769280 KB Output is correct
53 Correct 438 ms 768268 KB Output is correct
54 Correct 476 ms 764608 KB Output is correct
55 Correct 606 ms 802700 KB Output is correct
56 Correct 437 ms 768844 KB Output is correct
57 Correct 803 ms 820552 KB Output is correct
58 Correct 834 ms 826760 KB Output is correct
59 Correct 687 ms 826432 KB Output is correct
60 Correct 659 ms 811260 KB Output is correct
61 Correct 608 ms 801392 KB Output is correct
62 Correct 794 ms 828360 KB Output is correct
63 Correct 803 ms 824128 KB Output is correct
64 Correct 660 ms 821564 KB Output is correct
65 Correct 550 ms 812456 KB Output is correct
66 Correct 474 ms 786884 KB Output is correct
67 Correct 734 ms 816668 KB Output is correct
68 Correct 799 ms 824368 KB Output is correct
69 Correct 803 ms 824388 KB Output is correct
70 Correct 840 ms 824608 KB Output is correct
71 Correct 858 ms 824712 KB Output is correct
72 Correct 646 ms 814284 KB Output is correct
73 Correct 654 ms 811448 KB Output is correct
74 Correct 528 ms 801564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 328 ms 740012 KB Output is correct
2 Correct 373 ms 740028 KB Output is correct
3 Correct 324 ms 740404 KB Output is correct
4 Correct 334 ms 740536 KB Output is correct
5 Correct 331 ms 740428 KB Output is correct
6 Correct 328 ms 740432 KB Output is correct
7 Correct 357 ms 740412 KB Output is correct
8 Correct 333 ms 740276 KB Output is correct
9 Correct 342 ms 739976 KB Output is correct
10 Correct 334 ms 740024 KB Output is correct
11 Correct 331 ms 739960 KB Output is correct
12 Correct 333 ms 739952 KB Output is correct
13 Correct 350 ms 740044 KB Output is correct
14 Correct 327 ms 740172 KB Output is correct
15 Correct 371 ms 740124 KB Output is correct
16 Correct 329 ms 740428 KB Output is correct
17 Correct 341 ms 740536 KB Output is correct
18 Correct 338 ms 740476 KB Output is correct
19 Correct 421 ms 764960 KB Output is correct
20 Correct 380 ms 754540 KB Output is correct
21 Correct 486 ms 774452 KB Output is correct
22 Correct 556 ms 768512 KB Output is correct
23 Correct 438 ms 764572 KB Output is correct
24 Correct 402 ms 768908 KB Output is correct
25 Correct 384 ms 758584 KB Output is correct
26 Correct 421 ms 769240 KB Output is correct
27 Correct 411 ms 768300 KB Output is correct
28 Correct 456 ms 764724 KB Output is correct
29 Correct 580 ms 802592 KB Output is correct
30 Correct 426 ms 768900 KB Output is correct
31 Correct 721 ms 826432 KB Output is correct
32 Correct 666 ms 811440 KB Output is correct
33 Correct 575 ms 801400 KB Output is correct
34 Correct 550 ms 812476 KB Output is correct
35 Correct 445 ms 786872 KB Output is correct
36 Correct 644 ms 814156 KB Output is correct
37 Correct 641 ms 811416 KB Output is correct
38 Correct 509 ms 801672 KB Output is correct
39 Execution timed out 2152 ms 1358636 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 328 ms 740012 KB Output is correct
2 Correct 373 ms 740028 KB Output is correct
3 Correct 324 ms 740404 KB Output is correct
4 Correct 334 ms 740536 KB Output is correct
5 Correct 331 ms 740428 KB Output is correct
6 Correct 328 ms 740432 KB Output is correct
7 Correct 357 ms 740412 KB Output is correct
8 Correct 333 ms 740276 KB Output is correct
9 Correct 342 ms 739976 KB Output is correct
10 Correct 334 ms 740024 KB Output is correct
11 Correct 331 ms 739960 KB Output is correct
12 Correct 333 ms 739952 KB Output is correct
13 Correct 350 ms 740044 KB Output is correct
14 Correct 327 ms 740172 KB Output is correct
15 Correct 371 ms 740124 KB Output is correct
16 Correct 329 ms 740428 KB Output is correct
17 Correct 341 ms 740536 KB Output is correct
18 Correct 338 ms 740476 KB Output is correct
19 Correct 421 ms 764960 KB Output is correct
20 Correct 380 ms 754540 KB Output is correct
21 Correct 486 ms 774452 KB Output is correct
22 Correct 556 ms 768512 KB Output is correct
23 Correct 438 ms 764572 KB Output is correct
24 Correct 402 ms 768908 KB Output is correct
25 Correct 384 ms 758584 KB Output is correct
26 Correct 421 ms 769240 KB Output is correct
27 Correct 411 ms 768300 KB Output is correct
28 Correct 456 ms 764724 KB Output is correct
29 Correct 580 ms 802592 KB Output is correct
30 Correct 426 ms 768900 KB Output is correct
31 Correct 721 ms 826432 KB Output is correct
32 Correct 666 ms 811440 KB Output is correct
33 Correct 575 ms 801400 KB Output is correct
34 Correct 550 ms 812476 KB Output is correct
35 Correct 445 ms 786872 KB Output is correct
36 Correct 644 ms 814156 KB Output is correct
37 Correct 641 ms 811416 KB Output is correct
38 Correct 509 ms 801672 KB Output is correct
39 Execution timed out 2152 ms 1358636 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 328 ms 740012 KB Output is correct
2 Correct 373 ms 740028 KB Output is correct
3 Correct 324 ms 740404 KB Output is correct
4 Correct 334 ms 740536 KB Output is correct
5 Correct 331 ms 740428 KB Output is correct
6 Correct 328 ms 740432 KB Output is correct
7 Correct 357 ms 740412 KB Output is correct
8 Correct 333 ms 740276 KB Output is correct
9 Correct 342 ms 739976 KB Output is correct
10 Correct 334 ms 740024 KB Output is correct
11 Correct 331 ms 739960 KB Output is correct
12 Correct 333 ms 739952 KB Output is correct
13 Correct 350 ms 740044 KB Output is correct
14 Correct 327 ms 740172 KB Output is correct
15 Correct 371 ms 740124 KB Output is correct
16 Correct 329 ms 740428 KB Output is correct
17 Correct 341 ms 740536 KB Output is correct
18 Correct 338 ms 740476 KB Output is correct
19 Correct 421 ms 764960 KB Output is correct
20 Correct 380 ms 754540 KB Output is correct
21 Correct 486 ms 774452 KB Output is correct
22 Correct 556 ms 768512 KB Output is correct
23 Correct 438 ms 764572 KB Output is correct
24 Correct 402 ms 768908 KB Output is correct
25 Correct 384 ms 758584 KB Output is correct
26 Correct 421 ms 769240 KB Output is correct
27 Correct 411 ms 768300 KB Output is correct
28 Correct 456 ms 764724 KB Output is correct
29 Correct 580 ms 802592 KB Output is correct
30 Correct 426 ms 768900 KB Output is correct
31 Correct 721 ms 826432 KB Output is correct
32 Correct 666 ms 811440 KB Output is correct
33 Correct 575 ms 801400 KB Output is correct
34 Correct 550 ms 812476 KB Output is correct
35 Correct 445 ms 786872 KB Output is correct
36 Correct 644 ms 814156 KB Output is correct
37 Correct 641 ms 811416 KB Output is correct
38 Correct 509 ms 801672 KB Output is correct
39 Execution timed out 2152 ms 1358636 KB Time limit exceeded
40 Halted 0 ms 0 KB -