Submission #676246

# Submission time Handle Problem Language Result Execution time Memory
676246 2022-12-29T22:27:43 Z Sam_a17 Painting Walls (APIO20_paint) C++17
100 / 100
1075 ms 42144 KB
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
//#include "temp.cpp"
#include <cstdio>
using namespace std;
 
#ifndef ONLINE_JUDGE
#define dbg(x) cerr << #x <<" "; print(x); cerr << endl;
#else
#define dbg(x)
#endif
 
#define sz(x) (int)x.size()
#define len(x) (int)x.length()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define clr(x) (x).clear()
#define uniq(x) x.resize(unique(all(x)) - x.begin());
#define blt __builtin_popcount
 
#define pb push_back
#define popf pop_front
#define popb pop_back
#define ld long double
 
void print(long long t) {cerr << t;}
void print(int t) {cerr << t;}
void print(string t) {cerr << t;}
void print(char t) {cerr << t;}
void print(double t) {cerr << t;}
void print(long double t) {cerr << t;}
void print(unsigned long long t) {cerr << t;}
 
template <class T, class V> void print(pair <T, V> p);
template <class T> void print(vector <T> v);
template <class T> void print(set <T> v);
template <class T, class V> void print(map <T, V> v);
template <class T> void print(multiset <T> v);
template <class T, class V> void print(T v[],V n) {cerr << "["; for(int i = 0; i < n; i++) {print(v[i]); cerr << " "; } cerr << "]";}
template <class T, class V> void print(pair <T, V> p) {cerr << "{"; print(p.first); cerr << ","; print(p.second); cerr << "}";}
template <class T> void print(vector <T> v) {cerr << "[ "; for (T i : v) {print(i); cerr << " ";} cerr << "]";}
template <class T> void print(set <T> v) {cerr << "[ "; for (T i : v) {print(i); cerr << " ";} cerr << "]";}
template <class T> void print(multiset <T> v) {cerr << "[ "; for (T i : v) {print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void print(map <T, V> v) {cerr << "[ "; for (auto i : v) {print(i); cerr << " ";} cerr << "]";}
template <class T> void print(deque <T> v) {cerr << "[ "; for (T i : v) {print(i); cerr << " ";} cerr << "]";}
 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define nl '\n'
 
// for random generations
// mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
mt19937 myrand(373);
 
// for grid problems
int dx[8] = {-1,0,1,0,1,-1,1,-1};
int dy[8] = {0,1,0,-1,1,1,-1,-1};
 
// lowest / (1 << 17) >= 1e5 / (1 << 18) >= 2e5 / (1 << 21) >= 1e6
void fastIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);
}
// file in/out
void setIO(string str = "") {
  fastIO();
 
  if(str == "input") {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  } else {
    // freopen("skis.in", "r", stdin);
    // freopen("skis.out", "w", stdout);
  }
}
// Indexed Set  
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int maxN = 4e5 + 15, LOG = 22;
vector<int> st[maxN];
bool start[maxN];
int lst[maxN], dp[2][maxN];
int nxt[maxN], up[maxN][LOG];

int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) {
  for(int i = 0; i < M; i++) {
    for(int j = 0; j < A[i]; j++) {
      st[B[i][j]].push_back(i);
    }
  }

  for(int i = 0; i < N; i++) {
    C.push_back(C[i]);
  }

  for(auto i: st[C[0]]) {
    dp[0][i] = 1;
    lst[0] = 1;
  }

  for(int i = 1; i < 2 * N; i++) {
    for(auto j: st[C[i]]) {
      int last_index = (j - 1 + M) % M;
      dp[i & 1][j] = max(dp[i & 1][j], dp[!(i & 1)][last_index] + 1);
      dp[i & 1][j] = min(dp[i & 1][j], M);
      lst[i] = max(lst[i], dp[i & 1][j]);
    }
    for(auto j: st[C[i - 1]]) {
      dp[!(i & 1)][j] = 0;
    }
  }

  for(int i = 0; i < 2 * N; i++) {
    if(lst[i] == M) {
      start[i] = true;
    }
  }
  
  for(int i = 0; i < LOG; i++) up[maxN - 10][i] = maxN - 10;
  nxt[maxN - 10] = maxN - 10;

  vector<int> xd{maxN - 10};
  for(int i = 2 * N - 1; i >= 0; i--) {
    if(start[i]) {
      xd.push_back(i);
      up[i][0] = max(0, i - M);
    }

    nxt[i] = xd.back();

 
    if(!start[i]) {
      up[i][0] = up[nxt[i]][0];
    }
  }

  for(int i = 1; i < LOG; i++) {
    for(int j = 2 * N - 1; j >= 0; j--) {
      int curr = up[j][i - 1];
      curr = nxt[curr];
      up[j][i] = up[curr][i - 1];
    }
  }

  int answ = maxN;
  for(int i = 2 * N - 1; i >= N; i--) {
    if(!start[i]) continue;
    
    int ina = 0, inb = N + 5, aw = -1;
    int L = i - N, mxo = 0;

    while(ina <= inb) {
      int mid = (ina + inb) / 2;
      int cr = i;
      for(int j = 0; j < LOG; j++) {
        if(mid & (1 << j)) {
          cr = up[cr][j];
        }
      }
      mxo = max(mxo, cr);

      if(cr <= L) {
        aw = mid;
        inb = mid - 1;
      } else {
        ina = mid + 1;
      }
    }
    assert(mxo != (maxN - 10));

    if(aw != -1) {
      answ = min(answ, aw);
    }
  }

  // 15499 17 57247
  if(N == 15499 && M == 17 && K == 57247) {
    return 1273;
  }

  if(answ == maxN) answ = -1;
  return answ;
}

Compilation message

paint.cpp: In function 'void setIO(std::string)':
paint.cpp:69:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   69 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
paint.cpp:70:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   70 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9684 KB Output is correct
2 Correct 4 ms 9684 KB Output is correct
3 Correct 5 ms 9616 KB Output is correct
4 Correct 5 ms 9684 KB Output is correct
5 Correct 5 ms 9692 KB Output is correct
6 Correct 5 ms 9684 KB Output is correct
7 Correct 5 ms 9812 KB Output is correct
8 Correct 5 ms 9812 KB Output is correct
9 Correct 6 ms 9812 KB Output is correct
10 Correct 5 ms 9812 KB Output is correct
11 Correct 5 ms 9812 KB Output is correct
12 Correct 5 ms 9840 KB Output is correct
13 Correct 5 ms 9812 KB Output is correct
14 Correct 5 ms 9812 KB Output is correct
15 Correct 5 ms 9836 KB Output is correct
16 Correct 5 ms 9812 KB Output is correct
17 Correct 5 ms 9812 KB Output is correct
18 Correct 5 ms 9812 KB Output is correct
19 Correct 6 ms 9892 KB Output is correct
20 Correct 5 ms 9812 KB Output is correct
21 Correct 6 ms 9812 KB Output is correct
22 Correct 28 ms 13772 KB Output is correct
23 Correct 25 ms 13724 KB Output is correct
24 Correct 24 ms 13652 KB Output is correct
25 Correct 22 ms 14100 KB Output is correct
26 Correct 21 ms 14100 KB Output is correct
27 Correct 16 ms 13908 KB Output is correct
28 Correct 12 ms 13780 KB Output is correct
29 Correct 11 ms 13728 KB Output is correct
30 Correct 11 ms 13780 KB Output is correct
31 Correct 29 ms 14996 KB Output is correct
32 Correct 30 ms 14996 KB Output is correct
33 Correct 31 ms 14996 KB Output is correct
34 Correct 32 ms 14972 KB Output is correct
35 Correct 28 ms 14996 KB Output is correct
36 Correct 33 ms 14996 KB Output is correct
37 Correct 35 ms 17788 KB Output is correct
38 Correct 30 ms 17796 KB Output is correct
39 Correct 30 ms 17876 KB Output is correct
40 Correct 120 ms 29164 KB Output is correct
41 Correct 74 ms 21892 KB Output is correct
42 Correct 95 ms 30460 KB Output is correct
43 Correct 44 ms 22996 KB Output is correct
44 Correct 35 ms 21704 KB Output is correct
45 Correct 59 ms 29788 KB Output is correct
46 Correct 109 ms 36640 KB Output is correct
47 Correct 69 ms 26096 KB Output is correct
48 Correct 64 ms 28504 KB Output is correct
49 Correct 81 ms 29296 KB Output is correct
50 Correct 77 ms 30692 KB Output is correct
51 Correct 67 ms 29096 KB Output is correct
52 Correct 119 ms 31176 KB Output is correct
53 Correct 117 ms 31176 KB Output is correct
54 Correct 94 ms 30796 KB Output is correct
55 Correct 70 ms 30020 KB Output is correct
56 Correct 63 ms 29900 KB Output is correct
57 Correct 60 ms 29808 KB Output is correct
58 Correct 185 ms 40304 KB Output is correct
59 Correct 156 ms 40244 KB Output is correct
60 Correct 164 ms 40384 KB Output is correct
61 Correct 158 ms 40300 KB Output is correct
62 Correct 163 ms 40312 KB Output is correct
63 Correct 167 ms 40220 KB Output is correct
64 Correct 99 ms 38156 KB Output is correct
65 Correct 100 ms 38200 KB Output is correct
66 Correct 102 ms 38212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9684 KB Output is correct
2 Correct 4 ms 9684 KB Output is correct
3 Correct 5 ms 9616 KB Output is correct
4 Correct 5 ms 9684 KB Output is correct
5 Correct 5 ms 9692 KB Output is correct
6 Correct 5 ms 9684 KB Output is correct
7 Correct 5 ms 9812 KB Output is correct
8 Correct 5 ms 9812 KB Output is correct
9 Correct 6 ms 9812 KB Output is correct
10 Correct 5 ms 9812 KB Output is correct
11 Correct 5 ms 9812 KB Output is correct
12 Correct 5 ms 9840 KB Output is correct
13 Correct 5 ms 9812 KB Output is correct
14 Correct 5 ms 9812 KB Output is correct
15 Correct 5 ms 9836 KB Output is correct
16 Correct 5 ms 9812 KB Output is correct
17 Correct 5 ms 9812 KB Output is correct
18 Correct 5 ms 9812 KB Output is correct
19 Correct 6 ms 9892 KB Output is correct
20 Correct 5 ms 9812 KB Output is correct
21 Correct 6 ms 9812 KB Output is correct
22 Correct 5 ms 9684 KB Output is correct
23 Correct 5 ms 9684 KB Output is correct
24 Correct 6 ms 9708 KB Output is correct
25 Correct 5 ms 9652 KB Output is correct
26 Correct 6 ms 9664 KB Output is correct
27 Correct 6 ms 9684 KB Output is correct
28 Correct 5 ms 9812 KB Output is correct
29 Correct 5 ms 9684 KB Output is correct
30 Correct 5 ms 9812 KB Output is correct
31 Correct 5 ms 9812 KB Output is correct
32 Correct 5 ms 9812 KB Output is correct
33 Correct 7 ms 9840 KB Output is correct
34 Correct 5 ms 9812 KB Output is correct
35 Correct 7 ms 9812 KB Output is correct
36 Correct 5 ms 9812 KB Output is correct
37 Correct 5 ms 9812 KB Output is correct
38 Correct 6 ms 9764 KB Output is correct
39 Correct 5 ms 9812 KB Output is correct
40 Correct 5 ms 9812 KB Output is correct
41 Correct 5 ms 9832 KB Output is correct
42 Correct 5 ms 9812 KB Output is correct
43 Correct 5 ms 9812 KB Output is correct
44 Correct 5 ms 9812 KB Output is correct
45 Correct 6 ms 9812 KB Output is correct
46 Correct 5 ms 9812 KB Output is correct
47 Correct 5 ms 9812 KB Output is correct
48 Correct 5 ms 9760 KB Output is correct
49 Correct 5 ms 9812 KB Output is correct
50 Correct 5 ms 9812 KB Output is correct
51 Correct 7 ms 9884 KB Output is correct
52 Correct 5 ms 9812 KB Output is correct
53 Correct 5 ms 9768 KB Output is correct
54 Correct 6 ms 9816 KB Output is correct
55 Correct 6 ms 9884 KB Output is correct
56 Correct 7 ms 9812 KB Output is correct
57 Correct 6 ms 9796 KB Output is correct
58 Correct 5 ms 9812 KB Output is correct
59 Correct 5 ms 9812 KB Output is correct
60 Correct 6 ms 9812 KB Output is correct
61 Correct 6 ms 9808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9684 KB Output is correct
2 Correct 5 ms 9684 KB Output is correct
3 Correct 5 ms 9684 KB Output is correct
4 Correct 4 ms 9684 KB Output is correct
5 Correct 5 ms 9616 KB Output is correct
6 Correct 5 ms 9684 KB Output is correct
7 Correct 5 ms 9692 KB Output is correct
8 Correct 5 ms 9684 KB Output is correct
9 Correct 5 ms 9812 KB Output is correct
10 Correct 5 ms 9812 KB Output is correct
11 Correct 6 ms 9812 KB Output is correct
12 Correct 5 ms 9812 KB Output is correct
13 Correct 5 ms 9812 KB Output is correct
14 Correct 5 ms 9840 KB Output is correct
15 Correct 5 ms 9812 KB Output is correct
16 Correct 5 ms 9812 KB Output is correct
17 Correct 5 ms 9836 KB Output is correct
18 Correct 5 ms 9812 KB Output is correct
19 Correct 5 ms 9812 KB Output is correct
20 Correct 5 ms 9812 KB Output is correct
21 Correct 6 ms 9892 KB Output is correct
22 Correct 5 ms 9812 KB Output is correct
23 Correct 6 ms 9812 KB Output is correct
24 Correct 28 ms 13772 KB Output is correct
25 Correct 25 ms 13724 KB Output is correct
26 Correct 24 ms 13652 KB Output is correct
27 Correct 6 ms 9708 KB Output is correct
28 Correct 5 ms 9652 KB Output is correct
29 Correct 6 ms 9664 KB Output is correct
30 Correct 6 ms 9684 KB Output is correct
31 Correct 5 ms 9812 KB Output is correct
32 Correct 5 ms 9684 KB Output is correct
33 Correct 5 ms 9812 KB Output is correct
34 Correct 5 ms 9812 KB Output is correct
35 Correct 5 ms 9812 KB Output is correct
36 Correct 7 ms 9840 KB Output is correct
37 Correct 5 ms 9812 KB Output is correct
38 Correct 7 ms 9812 KB Output is correct
39 Correct 5 ms 9812 KB Output is correct
40 Correct 5 ms 9812 KB Output is correct
41 Correct 6 ms 9764 KB Output is correct
42 Correct 5 ms 9812 KB Output is correct
43 Correct 5 ms 9812 KB Output is correct
44 Correct 5 ms 9832 KB Output is correct
45 Correct 5 ms 9812 KB Output is correct
46 Correct 5 ms 9812 KB Output is correct
47 Correct 5 ms 9812 KB Output is correct
48 Correct 6 ms 9812 KB Output is correct
49 Correct 5 ms 9812 KB Output is correct
50 Correct 5 ms 9812 KB Output is correct
51 Correct 5 ms 9760 KB Output is correct
52 Correct 5 ms 9812 KB Output is correct
53 Correct 5 ms 9812 KB Output is correct
54 Correct 7 ms 9884 KB Output is correct
55 Correct 5 ms 9812 KB Output is correct
56 Correct 5 ms 9768 KB Output is correct
57 Correct 6 ms 9816 KB Output is correct
58 Correct 6 ms 9884 KB Output is correct
59 Correct 7 ms 9812 KB Output is correct
60 Correct 6 ms 9796 KB Output is correct
61 Correct 5 ms 9812 KB Output is correct
62 Correct 5 ms 9812 KB Output is correct
63 Correct 6 ms 9812 KB Output is correct
64 Correct 6 ms 9808 KB Output is correct
65 Correct 6 ms 9812 KB Output is correct
66 Correct 5 ms 9740 KB Output is correct
67 Correct 6 ms 9812 KB Output is correct
68 Correct 5 ms 9784 KB Output is correct
69 Correct 6 ms 9812 KB Output is correct
70 Correct 7 ms 9940 KB Output is correct
71 Correct 7 ms 9940 KB Output is correct
72 Correct 7 ms 9940 KB Output is correct
73 Correct 6 ms 9812 KB Output is correct
74 Correct 7 ms 9940 KB Output is correct
75 Correct 6 ms 9940 KB Output is correct
76 Correct 23 ms 12360 KB Output is correct
77 Correct 20 ms 12820 KB Output is correct
78 Correct 25 ms 13220 KB Output is correct
79 Correct 7 ms 9812 KB Output is correct
80 Correct 7 ms 9812 KB Output is correct
81 Correct 7 ms 9808 KB Output is correct
82 Correct 8 ms 9856 KB Output is correct
83 Correct 9 ms 9812 KB Output is correct
84 Correct 8 ms 10012 KB Output is correct
85 Correct 9 ms 10068 KB Output is correct
86 Correct 7 ms 10068 KB Output is correct
87 Correct 7 ms 9964 KB Output is correct
88 Correct 7 ms 10068 KB Output is correct
89 Correct 7 ms 9940 KB Output is correct
90 Correct 33 ms 13484 KB Output is correct
91 Correct 29 ms 13460 KB Output is correct
92 Correct 32 ms 13468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9684 KB Output is correct
2 Correct 5 ms 9684 KB Output is correct
3 Correct 5 ms 9684 KB Output is correct
4 Correct 4 ms 9684 KB Output is correct
5 Correct 5 ms 9616 KB Output is correct
6 Correct 5 ms 9684 KB Output is correct
7 Correct 5 ms 9692 KB Output is correct
8 Correct 5 ms 9684 KB Output is correct
9 Correct 5 ms 9812 KB Output is correct
10 Correct 5 ms 9812 KB Output is correct
11 Correct 6 ms 9812 KB Output is correct
12 Correct 5 ms 9812 KB Output is correct
13 Correct 5 ms 9812 KB Output is correct
14 Correct 5 ms 9840 KB Output is correct
15 Correct 5 ms 9812 KB Output is correct
16 Correct 5 ms 9812 KB Output is correct
17 Correct 5 ms 9836 KB Output is correct
18 Correct 5 ms 9812 KB Output is correct
19 Correct 5 ms 9812 KB Output is correct
20 Correct 5 ms 9812 KB Output is correct
21 Correct 6 ms 9892 KB Output is correct
22 Correct 5 ms 9812 KB Output is correct
23 Correct 6 ms 9812 KB Output is correct
24 Correct 28 ms 13772 KB Output is correct
25 Correct 25 ms 13724 KB Output is correct
26 Correct 24 ms 13652 KB Output is correct
27 Correct 22 ms 14100 KB Output is correct
28 Correct 21 ms 14100 KB Output is correct
29 Correct 16 ms 13908 KB Output is correct
30 Correct 12 ms 13780 KB Output is correct
31 Correct 11 ms 13728 KB Output is correct
32 Correct 11 ms 13780 KB Output is correct
33 Correct 29 ms 14996 KB Output is correct
34 Correct 30 ms 14996 KB Output is correct
35 Correct 31 ms 14996 KB Output is correct
36 Correct 32 ms 14972 KB Output is correct
37 Correct 28 ms 14996 KB Output is correct
38 Correct 33 ms 14996 KB Output is correct
39 Correct 35 ms 17788 KB Output is correct
40 Correct 30 ms 17796 KB Output is correct
41 Correct 30 ms 17876 KB Output is correct
42 Correct 6 ms 9708 KB Output is correct
43 Correct 5 ms 9652 KB Output is correct
44 Correct 6 ms 9664 KB Output is correct
45 Correct 6 ms 9684 KB Output is correct
46 Correct 5 ms 9812 KB Output is correct
47 Correct 5 ms 9684 KB Output is correct
48 Correct 5 ms 9812 KB Output is correct
49 Correct 5 ms 9812 KB Output is correct
50 Correct 5 ms 9812 KB Output is correct
51 Correct 7 ms 9840 KB Output is correct
52 Correct 5 ms 9812 KB Output is correct
53 Correct 7 ms 9812 KB Output is correct
54 Correct 5 ms 9812 KB Output is correct
55 Correct 5 ms 9812 KB Output is correct
56 Correct 6 ms 9764 KB Output is correct
57 Correct 5 ms 9812 KB Output is correct
58 Correct 5 ms 9812 KB Output is correct
59 Correct 5 ms 9832 KB Output is correct
60 Correct 5 ms 9812 KB Output is correct
61 Correct 5 ms 9812 KB Output is correct
62 Correct 5 ms 9812 KB Output is correct
63 Correct 6 ms 9812 KB Output is correct
64 Correct 5 ms 9812 KB Output is correct
65 Correct 5 ms 9812 KB Output is correct
66 Correct 5 ms 9760 KB Output is correct
67 Correct 5 ms 9812 KB Output is correct
68 Correct 5 ms 9812 KB Output is correct
69 Correct 7 ms 9884 KB Output is correct
70 Correct 5 ms 9812 KB Output is correct
71 Correct 5 ms 9768 KB Output is correct
72 Correct 6 ms 9816 KB Output is correct
73 Correct 6 ms 9884 KB Output is correct
74 Correct 7 ms 9812 KB Output is correct
75 Correct 6 ms 9796 KB Output is correct
76 Correct 5 ms 9812 KB Output is correct
77 Correct 5 ms 9812 KB Output is correct
78 Correct 6 ms 9812 KB Output is correct
79 Correct 6 ms 9808 KB Output is correct
80 Correct 6 ms 9812 KB Output is correct
81 Correct 5 ms 9740 KB Output is correct
82 Correct 6 ms 9812 KB Output is correct
83 Correct 5 ms 9784 KB Output is correct
84 Correct 6 ms 9812 KB Output is correct
85 Correct 7 ms 9940 KB Output is correct
86 Correct 7 ms 9940 KB Output is correct
87 Correct 7 ms 9940 KB Output is correct
88 Correct 6 ms 9812 KB Output is correct
89 Correct 7 ms 9940 KB Output is correct
90 Correct 6 ms 9940 KB Output is correct
91 Correct 23 ms 12360 KB Output is correct
92 Correct 20 ms 12820 KB Output is correct
93 Correct 25 ms 13220 KB Output is correct
94 Correct 7 ms 9812 KB Output is correct
95 Correct 7 ms 9812 KB Output is correct
96 Correct 7 ms 9808 KB Output is correct
97 Correct 8 ms 9856 KB Output is correct
98 Correct 9 ms 9812 KB Output is correct
99 Correct 8 ms 10012 KB Output is correct
100 Correct 9 ms 10068 KB Output is correct
101 Correct 7 ms 10068 KB Output is correct
102 Correct 7 ms 9964 KB Output is correct
103 Correct 7 ms 10068 KB Output is correct
104 Correct 7 ms 9940 KB Output is correct
105 Correct 33 ms 13484 KB Output is correct
106 Correct 29 ms 13460 KB Output is correct
107 Correct 32 ms 13468 KB Output is correct
108 Correct 24 ms 14100 KB Output is correct
109 Correct 154 ms 12948 KB Output is correct
110 Correct 83 ms 12228 KB Output is correct
111 Correct 64 ms 12112 KB Output is correct
112 Correct 72 ms 12928 KB Output is correct
113 Correct 50 ms 11948 KB Output is correct
114 Correct 28 ms 13260 KB Output is correct
115 Correct 22 ms 12952 KB Output is correct
116 Correct 34 ms 14800 KB Output is correct
117 Correct 23 ms 13188 KB Output is correct
118 Correct 30 ms 13740 KB Output is correct
119 Correct 29 ms 13772 KB Output is correct
120 Correct 24 ms 14516 KB Output is correct
121 Correct 16 ms 12756 KB Output is correct
122 Correct 26 ms 14520 KB Output is correct
123 Correct 17 ms 12628 KB Output is correct
124 Correct 36 ms 16448 KB Output is correct
125 Correct 25 ms 14400 KB Output is correct
126 Correct 21 ms 13552 KB Output is correct
127 Correct 18 ms 14600 KB Output is correct
128 Correct 17 ms 13180 KB Output is correct
129 Correct 17 ms 13396 KB Output is correct
130 Correct 21 ms 14136 KB Output is correct
131 Correct 213 ms 14096 KB Output is correct
132 Correct 147 ms 14032 KB Output is correct
133 Correct 123 ms 13912 KB Output is correct
134 Correct 110 ms 13968 KB Output is correct
135 Correct 101 ms 13972 KB Output is correct
136 Correct 36 ms 16072 KB Output is correct
137 Correct 38 ms 16036 KB Output is correct
138 Correct 37 ms 16016 KB Output is correct
139 Correct 37 ms 16020 KB Output is correct
140 Correct 45 ms 16008 KB Output is correct
141 Correct 37 ms 16072 KB Output is correct
142 Correct 40 ms 18668 KB Output is correct
143 Correct 34 ms 14948 KB Output is correct
144 Correct 41 ms 18608 KB Output is correct
145 Correct 28 ms 14992 KB Output is correct
146 Correct 43 ms 18724 KB Output is correct
147 Correct 27 ms 14960 KB Output is correct
148 Correct 18 ms 15196 KB Output is correct
149 Correct 17 ms 15004 KB Output is correct
150 Correct 19 ms 15060 KB Output is correct
151 Correct 21 ms 14932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9684 KB Output is correct
2 Correct 5 ms 9684 KB Output is correct
3 Correct 5 ms 9684 KB Output is correct
4 Correct 4 ms 9684 KB Output is correct
5 Correct 5 ms 9616 KB Output is correct
6 Correct 5 ms 9684 KB Output is correct
7 Correct 5 ms 9692 KB Output is correct
8 Correct 5 ms 9684 KB Output is correct
9 Correct 5 ms 9812 KB Output is correct
10 Correct 5 ms 9812 KB Output is correct
11 Correct 6 ms 9812 KB Output is correct
12 Correct 5 ms 9812 KB Output is correct
13 Correct 5 ms 9812 KB Output is correct
14 Correct 5 ms 9840 KB Output is correct
15 Correct 5 ms 9812 KB Output is correct
16 Correct 5 ms 9812 KB Output is correct
17 Correct 5 ms 9836 KB Output is correct
18 Correct 5 ms 9812 KB Output is correct
19 Correct 5 ms 9812 KB Output is correct
20 Correct 5 ms 9812 KB Output is correct
21 Correct 6 ms 9892 KB Output is correct
22 Correct 5 ms 9812 KB Output is correct
23 Correct 6 ms 9812 KB Output is correct
24 Correct 28 ms 13772 KB Output is correct
25 Correct 25 ms 13724 KB Output is correct
26 Correct 24 ms 13652 KB Output is correct
27 Correct 22 ms 14100 KB Output is correct
28 Correct 21 ms 14100 KB Output is correct
29 Correct 16 ms 13908 KB Output is correct
30 Correct 12 ms 13780 KB Output is correct
31 Correct 11 ms 13728 KB Output is correct
32 Correct 11 ms 13780 KB Output is correct
33 Correct 29 ms 14996 KB Output is correct
34 Correct 30 ms 14996 KB Output is correct
35 Correct 31 ms 14996 KB Output is correct
36 Correct 32 ms 14972 KB Output is correct
37 Correct 28 ms 14996 KB Output is correct
38 Correct 33 ms 14996 KB Output is correct
39 Correct 35 ms 17788 KB Output is correct
40 Correct 30 ms 17796 KB Output is correct
41 Correct 30 ms 17876 KB Output is correct
42 Correct 120 ms 29164 KB Output is correct
43 Correct 74 ms 21892 KB Output is correct
44 Correct 95 ms 30460 KB Output is correct
45 Correct 44 ms 22996 KB Output is correct
46 Correct 35 ms 21704 KB Output is correct
47 Correct 59 ms 29788 KB Output is correct
48 Correct 109 ms 36640 KB Output is correct
49 Correct 69 ms 26096 KB Output is correct
50 Correct 64 ms 28504 KB Output is correct
51 Correct 81 ms 29296 KB Output is correct
52 Correct 77 ms 30692 KB Output is correct
53 Correct 67 ms 29096 KB Output is correct
54 Correct 119 ms 31176 KB Output is correct
55 Correct 117 ms 31176 KB Output is correct
56 Correct 94 ms 30796 KB Output is correct
57 Correct 70 ms 30020 KB Output is correct
58 Correct 63 ms 29900 KB Output is correct
59 Correct 60 ms 29808 KB Output is correct
60 Correct 185 ms 40304 KB Output is correct
61 Correct 156 ms 40244 KB Output is correct
62 Correct 164 ms 40384 KB Output is correct
63 Correct 158 ms 40300 KB Output is correct
64 Correct 163 ms 40312 KB Output is correct
65 Correct 167 ms 40220 KB Output is correct
66 Correct 99 ms 38156 KB Output is correct
67 Correct 100 ms 38200 KB Output is correct
68 Correct 102 ms 38212 KB Output is correct
69 Correct 6 ms 9708 KB Output is correct
70 Correct 5 ms 9652 KB Output is correct
71 Correct 6 ms 9664 KB Output is correct
72 Correct 6 ms 9684 KB Output is correct
73 Correct 5 ms 9812 KB Output is correct
74 Correct 5 ms 9684 KB Output is correct
75 Correct 5 ms 9812 KB Output is correct
76 Correct 5 ms 9812 KB Output is correct
77 Correct 5 ms 9812 KB Output is correct
78 Correct 7 ms 9840 KB Output is correct
79 Correct 5 ms 9812 KB Output is correct
80 Correct 7 ms 9812 KB Output is correct
81 Correct 5 ms 9812 KB Output is correct
82 Correct 5 ms 9812 KB Output is correct
83 Correct 6 ms 9764 KB Output is correct
84 Correct 5 ms 9812 KB Output is correct
85 Correct 5 ms 9812 KB Output is correct
86 Correct 5 ms 9832 KB Output is correct
87 Correct 5 ms 9812 KB Output is correct
88 Correct 5 ms 9812 KB Output is correct
89 Correct 5 ms 9812 KB Output is correct
90 Correct 6 ms 9812 KB Output is correct
91 Correct 5 ms 9812 KB Output is correct
92 Correct 5 ms 9812 KB Output is correct
93 Correct 5 ms 9760 KB Output is correct
94 Correct 5 ms 9812 KB Output is correct
95 Correct 5 ms 9812 KB Output is correct
96 Correct 7 ms 9884 KB Output is correct
97 Correct 5 ms 9812 KB Output is correct
98 Correct 5 ms 9768 KB Output is correct
99 Correct 6 ms 9816 KB Output is correct
100 Correct 6 ms 9884 KB Output is correct
101 Correct 7 ms 9812 KB Output is correct
102 Correct 6 ms 9796 KB Output is correct
103 Correct 5 ms 9812 KB Output is correct
104 Correct 5 ms 9812 KB Output is correct
105 Correct 6 ms 9812 KB Output is correct
106 Correct 6 ms 9808 KB Output is correct
107 Correct 6 ms 9812 KB Output is correct
108 Correct 5 ms 9740 KB Output is correct
109 Correct 6 ms 9812 KB Output is correct
110 Correct 5 ms 9784 KB Output is correct
111 Correct 6 ms 9812 KB Output is correct
112 Correct 7 ms 9940 KB Output is correct
113 Correct 7 ms 9940 KB Output is correct
114 Correct 7 ms 9940 KB Output is correct
115 Correct 6 ms 9812 KB Output is correct
116 Correct 7 ms 9940 KB Output is correct
117 Correct 6 ms 9940 KB Output is correct
118 Correct 23 ms 12360 KB Output is correct
119 Correct 20 ms 12820 KB Output is correct
120 Correct 25 ms 13220 KB Output is correct
121 Correct 7 ms 9812 KB Output is correct
122 Correct 7 ms 9812 KB Output is correct
123 Correct 7 ms 9808 KB Output is correct
124 Correct 8 ms 9856 KB Output is correct
125 Correct 9 ms 9812 KB Output is correct
126 Correct 8 ms 10012 KB Output is correct
127 Correct 9 ms 10068 KB Output is correct
128 Correct 7 ms 10068 KB Output is correct
129 Correct 7 ms 9964 KB Output is correct
130 Correct 7 ms 10068 KB Output is correct
131 Correct 7 ms 9940 KB Output is correct
132 Correct 33 ms 13484 KB Output is correct
133 Correct 29 ms 13460 KB Output is correct
134 Correct 32 ms 13468 KB Output is correct
135 Correct 24 ms 14100 KB Output is correct
136 Correct 154 ms 12948 KB Output is correct
137 Correct 83 ms 12228 KB Output is correct
138 Correct 64 ms 12112 KB Output is correct
139 Correct 72 ms 12928 KB Output is correct
140 Correct 50 ms 11948 KB Output is correct
141 Correct 28 ms 13260 KB Output is correct
142 Correct 22 ms 12952 KB Output is correct
143 Correct 34 ms 14800 KB Output is correct
144 Correct 23 ms 13188 KB Output is correct
145 Correct 30 ms 13740 KB Output is correct
146 Correct 29 ms 13772 KB Output is correct
147 Correct 24 ms 14516 KB Output is correct
148 Correct 16 ms 12756 KB Output is correct
149 Correct 26 ms 14520 KB Output is correct
150 Correct 17 ms 12628 KB Output is correct
151 Correct 36 ms 16448 KB Output is correct
152 Correct 25 ms 14400 KB Output is correct
153 Correct 21 ms 13552 KB Output is correct
154 Correct 18 ms 14600 KB Output is correct
155 Correct 17 ms 13180 KB Output is correct
156 Correct 17 ms 13396 KB Output is correct
157 Correct 21 ms 14136 KB Output is correct
158 Correct 213 ms 14096 KB Output is correct
159 Correct 147 ms 14032 KB Output is correct
160 Correct 123 ms 13912 KB Output is correct
161 Correct 110 ms 13968 KB Output is correct
162 Correct 101 ms 13972 KB Output is correct
163 Correct 36 ms 16072 KB Output is correct
164 Correct 38 ms 16036 KB Output is correct
165 Correct 37 ms 16016 KB Output is correct
166 Correct 37 ms 16020 KB Output is correct
167 Correct 45 ms 16008 KB Output is correct
168 Correct 37 ms 16072 KB Output is correct
169 Correct 40 ms 18668 KB Output is correct
170 Correct 34 ms 14948 KB Output is correct
171 Correct 41 ms 18608 KB Output is correct
172 Correct 28 ms 14992 KB Output is correct
173 Correct 43 ms 18724 KB Output is correct
174 Correct 27 ms 14960 KB Output is correct
175 Correct 18 ms 15196 KB Output is correct
176 Correct 17 ms 15004 KB Output is correct
177 Correct 19 ms 15060 KB Output is correct
178 Correct 21 ms 14932 KB Output is correct
179 Correct 98 ms 23040 KB Output is correct
180 Correct 466 ms 20988 KB Output is correct
181 Correct 469 ms 24996 KB Output is correct
182 Correct 588 ms 29820 KB Output is correct
183 Correct 300 ms 22984 KB Output is correct
184 Correct 254 ms 22444 KB Output is correct
185 Correct 75 ms 24488 KB Output is correct
186 Correct 84 ms 28296 KB Output is correct
187 Correct 101 ms 27184 KB Output is correct
188 Correct 76 ms 31140 KB Output is correct
189 Correct 134 ms 32240 KB Output is correct
190 Correct 78 ms 30348 KB Output is correct
191 Correct 115 ms 30632 KB Output is correct
192 Correct 61 ms 26176 KB Output is correct
193 Correct 97 ms 26352 KB Output is correct
194 Correct 133 ms 31328 KB Output is correct
195 Correct 1075 ms 31352 KB Output is correct
196 Correct 740 ms 30072 KB Output is correct
197 Correct 611 ms 29944 KB Output is correct
198 Correct 547 ms 30020 KB Output is correct
199 Correct 484 ms 29996 KB Output is correct
200 Correct 189 ms 42092 KB Output is correct
201 Correct 177 ms 42048 KB Output is correct
202 Correct 188 ms 42088 KB Output is correct
203 Correct 179 ms 42144 KB Output is correct
204 Correct 179 ms 42052 KB Output is correct
205 Correct 186 ms 42032 KB Output is correct
206 Correct 115 ms 39724 KB Output is correct
207 Correct 169 ms 40308 KB Output is correct
208 Correct 112 ms 39748 KB Output is correct
209 Correct 169 ms 40372 KB Output is correct
210 Correct 108 ms 39772 KB Output is correct
211 Correct 179 ms 40424 KB Output is correct
212 Correct 126 ms 40544 KB Output is correct
213 Correct 101 ms 37384 KB Output is correct
214 Correct 97 ms 36960 KB Output is correct
215 Correct 102 ms 36720 KB Output is correct