Submission #526187

# Submission time Handle Problem Language Result Execution time Memory
526187 2022-02-13T22:15:46 Z Plurm Diversity (CEOI21_diversity) C++11
64 / 100
7000 ms 7600 KB
#include <bits/stdc++.h>
using namespace std;

template <typename T>
class FenwickTree{
public:
  T* FT;
  int n;
  bool negmode;
  FenwickTree(int sz = 300000, bool negindex = true){
    n = sz+505;
    FT = new T[n];
    fill(FT, FT+n, (T)0);
    negmode = negindex;
  }
  inline void add(int idx, T amt){
    if(negmode) idx += n/2;
    while(idx < n){
      FT[idx] += amt;
      idx += idx & -idx;
    }
  }
  inline T sum(int idx){
    if(negmode) idx += n/2;
    T ret = (T)0;
    while(idx > 0){
      ret += FT[idx];
      idx -= idx & -idx;
    }
    return ret;
  }
  inline int lower_bound(const int& v){
    if(v > FT[1]) return 0;
    int cur = 1 << 18;
    int part = FT[cur];
    for(int i = 17; i >= 0; i--){
      if(part >= v){
        cur += 1 << i;
        part += FT[cur];
      }else{
        part -= FT[cur];
        cur -= 1 << i;
        part += FT[cur];
      }
    }
    if(part < v) return cur-1;
    return cur;
  }
  inline int upper_bound(const int& v){
    return lower_bound(v+1);
  }
};

FenwickTree<int> FT1; // Ri
FenwickTree<long long> FT2; // Ri * i
int cnt[300005];
int a[300005];
// abstract deque
// fenwick indexing:
// [...] [-3] [-2] [-1] [0] [1] [2] [...]
// deque indexing:
// [...] [6] [4] [2] [1] [3] [5] [...]
// invariant:
// dq[-i] <= dq[i] for all positive i
// dq[-i] >= dq[i+1] for all positive i

inline int dq2fw(int idx){
  return idx/2 * (idx % 2 ? 1 : -1);
}

FenwickTree<int> dq(300000, false); // using deque indexing
inline long long deque_add(const int& x){
  int idx = dq.upper_bound(x)+1;
  dq.add(idx, 1);
  dq.add(idx+1, -1);
  int b = dq2fw(idx);
  FT1.add(b, 1);
  FT2.add(b, b);
  return FT2.sum(FT2.n/2-1) - FT2.sum(b) - 1ll * (b-1) * (FT1.sum(FT1.n/2-1) - FT1.sum(b))
  + 1ll * (b+1) * FT1.sum(b-1) - FT2.sum(b-1) + x+1;
}
inline long long deque_remove(const int& x){
  int idx = dq.lower_bound(x);
  dq.add(idx, -1);
  dq.add(idx+1, 1);
  int b = dq2fw(idx);
  FT1.add(b, -1);
  FT2.add(b, -b);
  return FT2.sum(FT2.n/2-1) - FT2.sum(b) - 1ll * (b-1) * (FT1.sum(FT1.n/2-1) - FT1.sum(b))
  + 1ll * (b+1) * FT1.sum(b-1) - FT2.sum(b-1) + x;
}

vector<tuple<int,int,int>> qbckt[2048]; // (L, R, Q)
long long answer[50005];
int qcnt[2048];

int main(){
	int n,q;
	scanf("%d%d",&n,&q);
	for(int i = 1; i <= n; i++){
		scanf("%d",a+i);
	}
  int SQRT = 1500;
  vector<pair<int,int>> rawq;
  for(int i = 0; i < q; i++){
    int l, r;
    scanf("%d%d",&l,&r);
    rawq.emplace_back(l,r);
    qcnt[l/SQRT]++;
  }
  for(int i = 0; i <= n/SQRT+2; i++){
    qbckt[i].reserve(qcnt[i]);
  }
  for(int i = 0; i < q; i++){
    int l, r;
    tie(l, r) = rawq[i];
    qbckt[l / SQRT].emplace_back(l, r, i);
  }
  int lptr = 1;
  int rptr = 0;
  long long ans = 0ll;
  for(int i = 0; i <= n/SQRT+2; i++){
    sort(qbckt[i].begin(), qbckt[i].end(), [](tuple<int,int,int> x, tuple<int,int,int> y){
      return get<1>(x) < get<1>(y);
    });
    // Below goes declaratively.
    for(auto qr : qbckt[i]){
      int l, r, qnum;
      tie(l, r, qnum) = qr;
      while(rptr < r){
        rptr++;
        ans += deque_add(cnt[a[rptr]]);
        cnt[a[rptr]]++;
      }
      while(lptr > l){
        lptr--;
        ans += deque_add(cnt[a[lptr]]);
        cnt[a[lptr]]++;
      }
      while(lptr < l){
        ans -= deque_remove(cnt[a[lptr]]);
        cnt[a[lptr]]--;
        lptr++;
      }
      while(rptr > r){
        ans -= deque_remove(cnt[a[rptr]]);
        cnt[a[rptr]]--;
        rptr--;
      }
      answer[qnum] = ans;
    }
  }
  for(int i = 0; i < q; i++){
    printf("%lld\n", answer[i]);
  }
	return 0;
}

Compilation message

diversity.cpp: In function 'int main()':
diversity.cpp:99:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   99 |  scanf("%d%d",&n,&q);
      |  ~~~~~^~~~~~~~~~~~~~
diversity.cpp:101:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  101 |   scanf("%d",a+i);
      |   ~~~~~^~~~~~~~~~
diversity.cpp:107:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  107 |     scanf("%d%d",&l,&r);
      |     ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5088 KB Output is correct
2 Correct 2 ms 5068 KB Output is correct
3 Correct 2 ms 5068 KB Output is correct
4 Correct 2 ms 5068 KB Output is correct
5 Correct 2 ms 5068 KB Output is correct
6 Correct 3 ms 5068 KB Output is correct
7 Correct 2 ms 5068 KB Output is correct
8 Correct 2 ms 5068 KB Output is correct
9 Correct 2 ms 5068 KB Output is correct
10 Correct 3 ms 5068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5072 KB Output is correct
2 Correct 2 ms 5080 KB Output is correct
3 Correct 5 ms 5068 KB Output is correct
4 Correct 29 ms 5588 KB Output is correct
5 Correct 58 ms 5964 KB Output is correct
6 Correct 77 ms 6360 KB Output is correct
7 Correct 77 ms 6356 KB Output is correct
8 Correct 83 ms 6368 KB Output is correct
9 Correct 77 ms 6356 KB Output is correct
10 Correct 77 ms 6268 KB Output is correct
11 Correct 81 ms 6320 KB Output is correct
12 Correct 82 ms 6340 KB Output is correct
13 Correct 79 ms 6360 KB Output is correct
14 Correct 78 ms 6352 KB Output is correct
15 Correct 82 ms 6336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5072 KB Output is correct
2 Correct 2 ms 5080 KB Output is correct
3 Correct 5 ms 5068 KB Output is correct
4 Correct 29 ms 5588 KB Output is correct
5 Correct 58 ms 5964 KB Output is correct
6 Correct 77 ms 6360 KB Output is correct
7 Correct 77 ms 6356 KB Output is correct
8 Correct 83 ms 6368 KB Output is correct
9 Correct 77 ms 6356 KB Output is correct
10 Correct 77 ms 6268 KB Output is correct
11 Correct 81 ms 6320 KB Output is correct
12 Correct 82 ms 6340 KB Output is correct
13 Correct 79 ms 6360 KB Output is correct
14 Correct 78 ms 6352 KB Output is correct
15 Correct 82 ms 6336 KB Output is correct
16 Correct 2 ms 5068 KB Output is correct
17 Correct 2 ms 5068 KB Output is correct
18 Correct 6 ms 5068 KB Output is correct
19 Correct 31 ms 5492 KB Output is correct
20 Correct 58 ms 5964 KB Output is correct
21 Correct 80 ms 6364 KB Output is correct
22 Correct 79 ms 6356 KB Output is correct
23 Correct 82 ms 6352 KB Output is correct
24 Correct 80 ms 6356 KB Output is correct
25 Correct 84 ms 6340 KB Output is correct
26 Correct 83 ms 6268 KB Output is correct
27 Correct 84 ms 6328 KB Output is correct
28 Correct 85 ms 6364 KB Output is correct
29 Correct 81 ms 6360 KB Output is correct
30 Correct 84 ms 6412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5072 KB Output is correct
2 Correct 2 ms 5080 KB Output is correct
3 Correct 5 ms 5068 KB Output is correct
4 Correct 29 ms 5588 KB Output is correct
5 Correct 58 ms 5964 KB Output is correct
6 Correct 77 ms 6360 KB Output is correct
7 Correct 77 ms 6356 KB Output is correct
8 Correct 83 ms 6368 KB Output is correct
9 Correct 77 ms 6356 KB Output is correct
10 Correct 77 ms 6268 KB Output is correct
11 Correct 81 ms 6320 KB Output is correct
12 Correct 82 ms 6340 KB Output is correct
13 Correct 79 ms 6360 KB Output is correct
14 Correct 78 ms 6352 KB Output is correct
15 Correct 82 ms 6336 KB Output is correct
16 Correct 2 ms 5068 KB Output is correct
17 Correct 2 ms 5068 KB Output is correct
18 Correct 6 ms 5068 KB Output is correct
19 Correct 31 ms 5492 KB Output is correct
20 Correct 58 ms 5964 KB Output is correct
21 Correct 80 ms 6364 KB Output is correct
22 Correct 79 ms 6356 KB Output is correct
23 Correct 82 ms 6352 KB Output is correct
24 Correct 80 ms 6356 KB Output is correct
25 Correct 84 ms 6340 KB Output is correct
26 Correct 83 ms 6268 KB Output is correct
27 Correct 84 ms 6328 KB Output is correct
28 Correct 85 ms 6364 KB Output is correct
29 Correct 81 ms 6360 KB Output is correct
30 Correct 84 ms 6412 KB Output is correct
31 Correct 3 ms 5120 KB Output is correct
32 Correct 3 ms 5068 KB Output is correct
33 Correct 3 ms 5068 KB Output is correct
34 Correct 5 ms 5068 KB Output is correct
35 Correct 5 ms 5068 KB Output is correct
36 Correct 5 ms 5068 KB Output is correct
37 Correct 17 ms 5396 KB Output is correct
38 Correct 17 ms 5372 KB Output is correct
39 Correct 32 ms 5580 KB Output is correct
40 Correct 61 ms 5956 KB Output is correct
41 Correct 95 ms 6248 KB Output is correct
42 Correct 88 ms 6360 KB Output is correct
43 Correct 88 ms 6348 KB Output is correct
44 Correct 88 ms 6336 KB Output is correct
45 Correct 87 ms 6304 KB Output is correct
46 Correct 88 ms 6312 KB Output is correct
47 Correct 89 ms 6356 KB Output is correct
48 Correct 89 ms 6364 KB Output is correct
49 Correct 92 ms 6364 KB Output is correct
50 Correct 91 ms 6360 KB Output is correct
51 Correct 88 ms 6360 KB Output is correct
52 Correct 89 ms 6468 KB Output is correct
53 Correct 90 ms 6324 KB Output is correct
54 Correct 90 ms 6356 KB Output is correct
55 Correct 95 ms 6360 KB Output is correct
56 Correct 89 ms 6364 KB Output is correct
57 Correct 94 ms 6412 KB Output is correct
58 Correct 87 ms 6348 KB Output is correct
59 Correct 100 ms 6356 KB Output is correct
60 Correct 88 ms 6252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5088 KB Output is correct
2 Correct 2 ms 5068 KB Output is correct
3 Correct 2 ms 5068 KB Output is correct
4 Correct 2 ms 5068 KB Output is correct
5 Correct 2 ms 5068 KB Output is correct
6 Correct 3 ms 5068 KB Output is correct
7 Correct 2 ms 5068 KB Output is correct
8 Correct 2 ms 5068 KB Output is correct
9 Correct 2 ms 5068 KB Output is correct
10 Correct 3 ms 5068 KB Output is correct
11 Correct 2 ms 5072 KB Output is correct
12 Correct 2 ms 5080 KB Output is correct
13 Correct 5 ms 5068 KB Output is correct
14 Correct 29 ms 5588 KB Output is correct
15 Correct 58 ms 5964 KB Output is correct
16 Correct 77 ms 6360 KB Output is correct
17 Correct 77 ms 6356 KB Output is correct
18 Correct 83 ms 6368 KB Output is correct
19 Correct 77 ms 6356 KB Output is correct
20 Correct 77 ms 6268 KB Output is correct
21 Correct 81 ms 6320 KB Output is correct
22 Correct 82 ms 6340 KB Output is correct
23 Correct 79 ms 6360 KB Output is correct
24 Correct 78 ms 6352 KB Output is correct
25 Correct 82 ms 6336 KB Output is correct
26 Correct 2 ms 5068 KB Output is correct
27 Correct 2 ms 5068 KB Output is correct
28 Correct 6 ms 5068 KB Output is correct
29 Correct 31 ms 5492 KB Output is correct
30 Correct 58 ms 5964 KB Output is correct
31 Correct 80 ms 6364 KB Output is correct
32 Correct 79 ms 6356 KB Output is correct
33 Correct 82 ms 6352 KB Output is correct
34 Correct 80 ms 6356 KB Output is correct
35 Correct 84 ms 6340 KB Output is correct
36 Correct 83 ms 6268 KB Output is correct
37 Correct 84 ms 6328 KB Output is correct
38 Correct 85 ms 6364 KB Output is correct
39 Correct 81 ms 6360 KB Output is correct
40 Correct 84 ms 6412 KB Output is correct
41 Correct 3 ms 5120 KB Output is correct
42 Correct 3 ms 5068 KB Output is correct
43 Correct 3 ms 5068 KB Output is correct
44 Correct 5 ms 5068 KB Output is correct
45 Correct 5 ms 5068 KB Output is correct
46 Correct 5 ms 5068 KB Output is correct
47 Correct 17 ms 5396 KB Output is correct
48 Correct 17 ms 5372 KB Output is correct
49 Correct 32 ms 5580 KB Output is correct
50 Correct 61 ms 5956 KB Output is correct
51 Correct 95 ms 6248 KB Output is correct
52 Correct 88 ms 6360 KB Output is correct
53 Correct 88 ms 6348 KB Output is correct
54 Correct 88 ms 6336 KB Output is correct
55 Correct 87 ms 6304 KB Output is correct
56 Correct 88 ms 6312 KB Output is correct
57 Correct 89 ms 6356 KB Output is correct
58 Correct 89 ms 6364 KB Output is correct
59 Correct 92 ms 6364 KB Output is correct
60 Correct 91 ms 6360 KB Output is correct
61 Correct 88 ms 6360 KB Output is correct
62 Correct 89 ms 6468 KB Output is correct
63 Correct 90 ms 6324 KB Output is correct
64 Correct 90 ms 6356 KB Output is correct
65 Correct 95 ms 6360 KB Output is correct
66 Correct 89 ms 6364 KB Output is correct
67 Correct 94 ms 6412 KB Output is correct
68 Correct 87 ms 6348 KB Output is correct
69 Correct 100 ms 6356 KB Output is correct
70 Correct 88 ms 6252 KB Output is correct
71 Correct 17 ms 5324 KB Output is correct
72 Correct 18 ms 5324 KB Output is correct
73 Correct 18 ms 5404 KB Output is correct
74 Correct 21 ms 5476 KB Output is correct
75 Correct 17 ms 5404 KB Output is correct
76 Correct 32 ms 5580 KB Output is correct
77 Correct 34 ms 5600 KB Output is correct
78 Correct 32 ms 5584 KB Output is correct
79 Correct 33 ms 5592 KB Output is correct
80 Correct 33 ms 5708 KB Output is correct
81 Correct 62 ms 6024 KB Output is correct
82 Correct 65 ms 6088 KB Output is correct
83 Correct 63 ms 6000 KB Output is correct
84 Correct 63 ms 5916 KB Output is correct
85 Correct 63 ms 5964 KB Output is correct
86 Correct 66 ms 6048 KB Output is correct
87 Correct 64 ms 6040 KB Output is correct
88 Correct 67 ms 6040 KB Output is correct
89 Correct 65 ms 5972 KB Output is correct
90 Correct 66 ms 5952 KB Output is correct
91 Correct 95 ms 6684 KB Output is correct
92 Correct 95 ms 6724 KB Output is correct
93 Correct 96 ms 6672 KB Output is correct
94 Correct 97 ms 6852 KB Output is correct
95 Correct 96 ms 6724 KB Output is correct
96 Correct 93 ms 7108 KB Output is correct
97 Correct 94 ms 7100 KB Output is correct
98 Correct 98 ms 7236 KB Output is correct
99 Correct 95 ms 7112 KB Output is correct
100 Correct 92 ms 7056 KB Output is correct
101 Correct 90 ms 7136 KB Output is correct
102 Correct 95 ms 7132 KB Output is correct
103 Correct 94 ms 7208 KB Output is correct
104 Correct 91 ms 7108 KB Output is correct
105 Correct 100 ms 7132 KB Output is correct
106 Correct 91 ms 7336 KB Output is correct
107 Correct 92 ms 7236 KB Output is correct
108 Correct 94 ms 7328 KB Output is correct
109 Correct 89 ms 7320 KB Output is correct
110 Correct 92 ms 7332 KB Output is correct
111 Correct 88 ms 7236 KB Output is correct
112 Correct 91 ms 7368 KB Output is correct
113 Correct 95 ms 7236 KB Output is correct
114 Correct 91 ms 7328 KB Output is correct
115 Correct 87 ms 7340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 5088 KB Output is correct
2 Correct 2 ms 5068 KB Output is correct
3 Correct 2 ms 5068 KB Output is correct
4 Correct 2 ms 5068 KB Output is correct
5 Correct 2 ms 5068 KB Output is correct
6 Correct 3 ms 5068 KB Output is correct
7 Correct 2 ms 5068 KB Output is correct
8 Correct 2 ms 5068 KB Output is correct
9 Correct 2 ms 5068 KB Output is correct
10 Correct 3 ms 5068 KB Output is correct
11 Correct 2 ms 5072 KB Output is correct
12 Correct 2 ms 5080 KB Output is correct
13 Correct 5 ms 5068 KB Output is correct
14 Correct 29 ms 5588 KB Output is correct
15 Correct 58 ms 5964 KB Output is correct
16 Correct 77 ms 6360 KB Output is correct
17 Correct 77 ms 6356 KB Output is correct
18 Correct 83 ms 6368 KB Output is correct
19 Correct 77 ms 6356 KB Output is correct
20 Correct 77 ms 6268 KB Output is correct
21 Correct 81 ms 6320 KB Output is correct
22 Correct 82 ms 6340 KB Output is correct
23 Correct 79 ms 6360 KB Output is correct
24 Correct 78 ms 6352 KB Output is correct
25 Correct 82 ms 6336 KB Output is correct
26 Correct 2 ms 5068 KB Output is correct
27 Correct 2 ms 5068 KB Output is correct
28 Correct 6 ms 5068 KB Output is correct
29 Correct 31 ms 5492 KB Output is correct
30 Correct 58 ms 5964 KB Output is correct
31 Correct 80 ms 6364 KB Output is correct
32 Correct 79 ms 6356 KB Output is correct
33 Correct 82 ms 6352 KB Output is correct
34 Correct 80 ms 6356 KB Output is correct
35 Correct 84 ms 6340 KB Output is correct
36 Correct 83 ms 6268 KB Output is correct
37 Correct 84 ms 6328 KB Output is correct
38 Correct 85 ms 6364 KB Output is correct
39 Correct 81 ms 6360 KB Output is correct
40 Correct 84 ms 6412 KB Output is correct
41 Correct 3 ms 5120 KB Output is correct
42 Correct 3 ms 5068 KB Output is correct
43 Correct 3 ms 5068 KB Output is correct
44 Correct 5 ms 5068 KB Output is correct
45 Correct 5 ms 5068 KB Output is correct
46 Correct 5 ms 5068 KB Output is correct
47 Correct 17 ms 5396 KB Output is correct
48 Correct 17 ms 5372 KB Output is correct
49 Correct 32 ms 5580 KB Output is correct
50 Correct 61 ms 5956 KB Output is correct
51 Correct 95 ms 6248 KB Output is correct
52 Correct 88 ms 6360 KB Output is correct
53 Correct 88 ms 6348 KB Output is correct
54 Correct 88 ms 6336 KB Output is correct
55 Correct 87 ms 6304 KB Output is correct
56 Correct 88 ms 6312 KB Output is correct
57 Correct 89 ms 6356 KB Output is correct
58 Correct 89 ms 6364 KB Output is correct
59 Correct 92 ms 6364 KB Output is correct
60 Correct 91 ms 6360 KB Output is correct
61 Correct 88 ms 6360 KB Output is correct
62 Correct 89 ms 6468 KB Output is correct
63 Correct 90 ms 6324 KB Output is correct
64 Correct 90 ms 6356 KB Output is correct
65 Correct 95 ms 6360 KB Output is correct
66 Correct 89 ms 6364 KB Output is correct
67 Correct 94 ms 6412 KB Output is correct
68 Correct 87 ms 6348 KB Output is correct
69 Correct 100 ms 6356 KB Output is correct
70 Correct 88 ms 6252 KB Output is correct
71 Correct 17 ms 5324 KB Output is correct
72 Correct 18 ms 5324 KB Output is correct
73 Correct 18 ms 5404 KB Output is correct
74 Correct 21 ms 5476 KB Output is correct
75 Correct 17 ms 5404 KB Output is correct
76 Correct 32 ms 5580 KB Output is correct
77 Correct 34 ms 5600 KB Output is correct
78 Correct 32 ms 5584 KB Output is correct
79 Correct 33 ms 5592 KB Output is correct
80 Correct 33 ms 5708 KB Output is correct
81 Correct 62 ms 6024 KB Output is correct
82 Correct 65 ms 6088 KB Output is correct
83 Correct 63 ms 6000 KB Output is correct
84 Correct 63 ms 5916 KB Output is correct
85 Correct 63 ms 5964 KB Output is correct
86 Correct 66 ms 6048 KB Output is correct
87 Correct 64 ms 6040 KB Output is correct
88 Correct 67 ms 6040 KB Output is correct
89 Correct 65 ms 5972 KB Output is correct
90 Correct 66 ms 5952 KB Output is correct
91 Correct 95 ms 6684 KB Output is correct
92 Correct 95 ms 6724 KB Output is correct
93 Correct 96 ms 6672 KB Output is correct
94 Correct 97 ms 6852 KB Output is correct
95 Correct 96 ms 6724 KB Output is correct
96 Correct 93 ms 7108 KB Output is correct
97 Correct 94 ms 7100 KB Output is correct
98 Correct 98 ms 7236 KB Output is correct
99 Correct 95 ms 7112 KB Output is correct
100 Correct 92 ms 7056 KB Output is correct
101 Correct 90 ms 7136 KB Output is correct
102 Correct 95 ms 7132 KB Output is correct
103 Correct 94 ms 7208 KB Output is correct
104 Correct 91 ms 7108 KB Output is correct
105 Correct 100 ms 7132 KB Output is correct
106 Correct 91 ms 7336 KB Output is correct
107 Correct 92 ms 7236 KB Output is correct
108 Correct 94 ms 7328 KB Output is correct
109 Correct 89 ms 7320 KB Output is correct
110 Correct 92 ms 7332 KB Output is correct
111 Correct 88 ms 7236 KB Output is correct
112 Correct 91 ms 7368 KB Output is correct
113 Correct 95 ms 7236 KB Output is correct
114 Correct 91 ms 7328 KB Output is correct
115 Correct 87 ms 7340 KB Output is correct
116 Correct 5081 ms 6972 KB Output is correct
117 Correct 5357 ms 6988 KB Output is correct
118 Correct 5727 ms 7356 KB Output is correct
119 Correct 5739 ms 7352 KB Output is correct
120 Correct 6316 ms 7268 KB Output is correct
121 Correct 6692 ms 7468 KB Output is correct
122 Execution timed out 7041 ms 7600 KB Time limit exceeded
123 Halted 0 ms 0 KB -