QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#251918#7776. 超现实树hos_lyric#5 813ms11120kbC++142.8kb2023-11-15 12:45:182024-07-04 02:25:31

Judging History

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

  • [2024-07-04 02:25:31]
  • 评测
  • 测评结果:5
  • 用时:813ms
  • 内存:11120kb
  • [2023-11-15 12:45:18]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


int N, M;
char C[100'010];
vector<int> A, B;

vector<vector<int>> graph;


namespace brute {
vector<int> stack;
vector<Int> ans;
void dfs(int u, int p, int k) {
  if (C[u] == '{') {
    stack.push_back(0);
  } else if (C[u] == '|') {
    if (stack.empty()) return;
    ++stack.back();
  } else if (C[u] == '}') {
    if (stack.empty()) return;
    if (!~k) k = stack.back();
    if (k != stack.back()) return;
    stack.pop_back();
  } else {
    assert(false);
  }
  
  if (stack.empty()) {
    assert(~k);
    ++ans[k];
  }
  for (const int v : graph[u]) if (p != v) {
    dfs(v, u, k);
  }
  
  if (C[u] == '{') {
    stack.pop_back();
  } else if (C[u] == '|') {
    if (stack.empty()) assert(false);
    --stack.back();
  } else if (C[u] == '}') {
    assert(~k);
    stack.push_back(k);
  } else {
    assert(false);
  }
}

vector<Int> run() {
cerr<<"[brute::run]"<<endl;
  ans.assign(N, 0);
  for (int r = 0; r < N; ++r) {
    stack.clear();
    dfs(r, -1, -1);
  }
  return ans;
}
}  // brute


int main() {
  for (; ~scanf("%d%d", &N, &M); ) {
    scanf("%s", C);
    A.resize(N - 1);
    B.resize(N - 1);
    for (int i = 0; i < N - 1; ++i) {
      scanf("%d%d", &A[i], &B[i]);
      --A[i];
      --B[i];
    }
    
    graph.assign(N, {});
    for (int i = 0; i < N - 1; ++i) {
      graph[A[i]].push_back(B[i]);
      graph[B[i]].push_back(A[i]);
    }
    
    const auto ans = brute::run();
    for (int k = 0; k <= M; ++k) {
      if (k) printf(" ");
      printf("%lld", ans[k]);
    }
    puts("");
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 3ms
memory: 4076kb

input:

4578 4576
|}}|}|{}{}|}|||{}}|}|||{|}||}}{}{{}|{{}|}}{}|{}{{}{{|{}}}|{||}||}}}}}|}}{||}|}{|{{}{}|{}{{}}}|{{}|}{}{}}}}}||}|}||||||{|}{}|}{|}{|}||}}}|}{{|}{{{}{}||{}}||}{}|}}{||{}}{}}|{|}{{|}}|{}||}}{}||}}|{|{{|}|{{}|{{{}}|||{}|||{{}}{||}{{|{{{{|{|}{|}{||}}}{{|}{}|{}}}{|}}{{|{|}{||{||||{|}}{{|}}{|||}}|...

output:

1736 642 213 88 42 16 8 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 4577 tokens

Test #2:

score: 5
Accepted
time: 2ms
memory: 4180kb

input:

4598 4596
||||||||}|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||{|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||{|||||||||||||||||||||||||||||||||||||||||||||||...

output:

1 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 4597 tokens

Test #3:

score: 5
Accepted
time: 234ms
memory: 4708kb

input:

4562 4560
}{}{{}{{{}}}}{{{{{}{{}{{{}}{{}{{{}}}{}{}}{}{{{{}}}{{}{{}}{{{{{{{{{{}}}{}}}}}{{{{{}}}}}{{}}{{}}{}{{}}{}{{}}}}}{{}}}}{{{}{}{}}{}{{{}}{{{{{{{}}}{}}}}}{}}{}{{}{}}}}{}{{{{}}}}{}{{}{}}}}{}}}{}}{{{}}}{{{{}}}}}}{}}{}}{}}{}{{{{}}}}{}{{{{{{{}}}{{{}}}}}{}{}}{}{}}}}{{{}}{}}}{{}}{}}{}}}}}{}}{{}}{}}}{{{...

output:

5094047 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 4561 tokens

Test #4:

score: 5
Accepted
time: 7ms
memory: 4380kb

input:

4558 4556
||{{}{}|{}||}}}{||}{{|{|{|||{|}|}|}}}{{}|}}}|}}|{{|||{{|{}}{||}|{}}||||{||{||}|}{|}{||{{{{}||{}}{{}}|||}{}||{|}|{{{}|{|{{}}|}|}}}}|{{|{|}|}|{|}{{}}{}||{}{}||}}|}}|}{|}|{}|}|{|{{{}}}|{|{{{{}}|}{{||{|{{||||}}{|}|{|||{}}}}{{{|{{{|||{{|{{}|{||||}}}||||}}}|{|}}|}{{|}{{{{}{|||}{{|}}{|}{}{{}}}}{}...

output:

2009 734 273 142 84 39 10 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 4557 tokens

Test #5:

score: 5
Accepted
time: 6ms
memory: 4388kb

input:

4560 4558
{}{{}}}{{{}}{{}}{{{}{}}}}}{{{}{{{}}{{}{{{}}{{}{{}}{}}|{}{{{{}{{}}{}{}}}}{{}|}}}{{}{}}}{}{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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 4593 tokens

Test #7:

score: 5
Accepted
time: 3ms
memory: 4380kb

input:

4561 4559
{}{{}{{}|{}{||}|}|{|{}|}}||{}||}}{||}}{{{{||}}}}|{|}}|||||{{|{|}}||{||{||{}}|{|{|{|}}||}{}{{}{|{}{{||}||||{|||}{}}}{}{{{{}}|}|}}}}|{}{|{|||{|||}{{{}}|}{}{{}{}|}}|{}|{|{}}{}{}}}|}|}{{}||{|}|}{}|}}}}|{}|}{{{}}{}|}}|}{{|{|}{{||{|}{|}}}}}{{||{}|{{{}{{|}}|{}}{}}}}}||}|{{{{{}}}||}||}|{{{{}}|}}{{...

output:

1828 565 244 83 27 11 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 4560 tokens

Test #8:

score: 5
Accepted
time: 39ms
memory: 4160kb

input:

4579 4577
{}}}}}{{}}{{{}}{}{{{}}}}{{{{}{{{{{{{{{{{{{{{}{}{}{}{}{{}}}}{{{}}{}{}{}}}}{{}}{}{}}{{{{}{{{{{{}}{}{}{{{{}}}}}{}{}}}}{{{{{}}{}}}}}{{}}{}}{{}{}{}}{{{}{}{}}{{}{{{}}}{}}{{}{{{}}}}}}{}{}}{{{{}}{{{}}}{{{}}}{{{{}}}}{{}}{{}{{}}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

result:

ok 4556 tokens

Test #10:

score: 5
Accepted
time: 4ms
memory: 4388kb

input:

4586 4584
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||...

output:

0 1 3 4 3 1 2 1 1 0 1 3 2 2 2 2 1 2 1 0 0 1 1 2 2 2 2 1 0 1 0 1 2 2 2 0 3 1 2 1 1 1 2 1 0 0 2 1 0 3 1 0 0 0 0 1 3 3 5 3 1 3 1 2 2 3 3 2 1 2 2 1 1 2 2 0 0 1 2 1 1 3 1 0 1 0 1 1 1 2 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 0 0 0 0 0 1 1 0 1 0 0 0 0 1 2 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 4585 tokens

Test #11:

score: 5
Accepted
time: 2ms
memory: 4268kb

input:

4596 4594
|}}}}|}}}|}}|}}}}|}}}}}|}|}|}}}}}|}}}||||}}|||}|}}|}}|||}|}|}|}|}|||||}}|}|}}|}|}}}}}}}}}}}}}}|}}}}}}||||}|||}}}}|}}}}|}|}|}|}}}|}|}}}}}||}}}}}|}||}}|}|}}}}||}}|}|}}|}||||||}}}}}||}||||}|}}}}||}}}}|||}|}|||}}}|||}}}}}|}}|||}|||}}}|}}||}|}}}}}||}}}||||}}|}|}|||}}}|}|}}|||||}}}|}}||}||}}||}}...

output:

0 0 2 0 1 3 0 0 2 0 0 1 2 0 0 1 1 1 0 1 1 0 2 0 2 3 1 1 2 3 0 2 1 2 1 0 0 0 3 1 4 4 1 5 2 2 1 1 0 3 0 1 0 0 1 0 0 0 0 1 2 0 2 4 1 1 5 1 2 3 1 4 1 1 3 0 0 2 0 3 1 0 3 1 0 2 0 2 1 0 1 3 0 3 1 2 3 1 0 0 2 0 0 5 3 0 1 0 4 0 0 2 1 2 1 1 1 2 1 1 0 1 1 0 2 0 2 2 2 1 1 0 1 2 0 2 1 3 2 0 0 0 1 1 0 0 2 0 0 3 ...

result:

ok 4595 tokens

Test #12:

score: 5
Accepted
time: 2ms
memory: 4384kb

input:

4562 4560
}|}}}|}}}}}|}}}}}}|}}}}}}}}}}}}}|}}}}}}}}}}}}}|}}}}|}}}}}}}}}}}}|}}}}}}}}}|}}}}|}}|}}}}}|}|||}}}}}|}}}}|}|}}|}}}}}}}}}|}}}}}}}}}}}}}}}}}}}}}}|}}|}}}}}}|}}}}|}}}}}|}}}|}}}}}}}}}}|}}|}}}}|}}}}|}}}}}}}}}}}}}}}}|}}|}}}}}}}}}}}}}|}}}|}}}}}}}}}}}}}}}}}}}}}}}}|}}}}}}}}}}}}}}}}}}}||}}}}}}}}}}}}}}}...

output:

9 4 7 10 9 7 6 9 12 16 1 8 12 7 10 12 2 3 10 6 8 12 12 17 10 10 5 6 7 10 12 9 12 2 7 12 1 6 9 11 6 9 9 12 10 10 7 10 7 7 5 8 5 2 5 9 13 7 4 7 10 6 6 3 5 13 7 13 10 7 7 8 5 9 10 8 9 10 10 7 3 13 6 9 8 9 6 6 6 7 10 7 7 7 7 12 9 8 6 9 7 6 5 9 4 10 11 7 8 10 11 8 8 7 8 9 13 8 8 6 7 6 9 7 9 2 6 5 5 11 14...

result:

ok 4561 tokens

Test #13:

score: 5
Accepted
time: 2ms
memory: 4508kb

input:

4578 4576
|}|||||||||||||||||||}|||||||}||||}}|||||||||||||||||||}||||||||||||||||}||}||}|||||||||||||||||||}||||||||||||||||||||||}}|||||||}}||||||||||||||||||||||||||||||||||||||||}||||||}||}||}|}||||}|||||}||||||||||||}||||||||||||}|||||||||||||||}|}|||||||}||||||||||||||||}||||||||||||||||}|||||...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 ...

result:

ok 4577 tokens

Test #14:

score: 5
Accepted
time: 75ms
memory: 4228kb

input:

4560 4558
}}}{}{{{{}{}{{}}{{{}{}}}}{{{{}}}{{{{}{{}{}{{{{{{}}}}}{}}{}|{{}{{}}{}{}}{{}{|{{{{}{{{{}{{}|{}|}}}{{{}}}}{}}}}}}}{{}}{{{{}}}{{}}{{}}|{}}{{}{{}}{}{}}}}}}{{}}|}{}}{}}}{{{}|{}{{}}}}}}}{}}}{{{}{{{{{{}{{{}}}|{}}}{{}}}}{{{}}}}}}}{}|}}{}{}{}|{{{{}{{{{}|{{}{}{}{}{}}{}}}{}}}}{{{|}}}}}}}}}{}}}{{{}{{{{...

output:

200 3999489 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 4559 tokens

Test #15:

score: 5
Accepted
time: 4ms
memory: 4100kb

input:

4582 4580
{|}}{|{}}{|{}}|{}|{|}{||{{{|{|}}}{}}|{}}{{|{|}}{{||{{|}|{}|||{}||}{}{{{|{|||{}}{||{||}}{|{|{|{{|||}}}||{{{{{|}{}|}{{}{}{{|{}}{}||}}{}{{{}{|}|}}{{{}|}}}}{}}{|{}}}}}{||{{{{|{|}{{}||{||}{{}|{|}}}}|{|||}}||{|{{}|{|}}{}{{{|}|}|}||}|{|}{{|}|{}}{{{{|{|{{|{}}{{|}|{}||{|{||}{}{}}}|||{|{}{{{|||}{{{}...

output:

1782 724 245 89 41 15 6 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 4581 tokens

Subtask #2:

score: 0
Time Limit Exceeded

Test #16:

score: 20
Accepted
time: 37ms
memory: 11120kb

input:

99981 99979
}|}{|}|}||{{{{|}}}{|}|}|}||||}}}|||||}|{{|||{|{}||}}{}}}}||{}{{}{{|{}{|}}}{|}||{|{}}|{{{|}{}{}}|}{}}{}||||}{|{{}{|{}}{}}|}}{|}{{}{{}|{|||{|{{}}{}{|}{||}}||}|}|}|{}{{}|}||}{{|{}{}}}||}}|}}||{||||||}}{}}}|}}|}}}}|}}}}||||{}}{{|{{}|}|{{}{|}||}{|}|}||{}}|}|{{{{{||{}}{}|{|}{{{|}|{|{|}}|{|}{}}...

output:

28892 8382 2558 832 288 88 39 4 4 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 99980 tokens

Test #17:

score: 20
Accepted
time: 35ms
memory: 11120kb

input:

99955 99953
{}{||{}{||}||{}{{{{{{}}|||{{{{}}}}{{}|{{{}{|}{}}{|{||{{|{}|}|{||||{|{{{{}{|}{}{}{{}}{}}}{}{}{}{{|{|{{{}|}{{{||{}{}||}{|}{}||}|||{|{}{}}||{}}{{}|}}{{}{{}{|}{}{}}}{||}{|}{|}{||{{{{}{{|}|||{|||{{|}}|{{}{|}{|{{}{}|}{||}}}}|||}||{}{{||||}||}{}|{|{}||{{{}{{{||}}|}{||}}}|}{}{|||}}}|{|{}{|{{{|{|...

output:

28685 8565 2557 826 268 90 33 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 99954 tokens

Test #18:

score: 0
Time Limit Exceeded

input:

99981 99979
||}|}|{}{{}{{{}}|{}}}|{{{}||{{||{{|}{}}}}{{|}{{}{}|}|{}}|}{{{}|}{}{{}}|}|}}|}{{||{{}{{||}|}}|}{|{|{{}{|{}|}|}}}{}|||{}}{|}{{{||||{{{|{{}}{{{{{{|}{}{}}}}||{|}}}||{}{{{{{}||{{|{}}|}{|}}|{}{{}|}||{{{{{|{|||}{|}}{}{{|}}|}{|{{|||||}|}|}}{{|{}|{{{}}|}}}}}|{}}||}{{{{|}{|{{}||}{||}{}}}|}|||{|}{}...

output:


result:


Subtask #3:

score: 0
Time Limit Exceeded

Test #26:

score: 0
Time Limit Exceeded

input:

99990 0
}}}}{{{}{{{{}}}}}{{{{{}}{{}{}}}{}}}{}}}{{{}{{{{}{}}}{{}{{{}{}{}{{{}}{{}}{{{}}{{{{{}{}{}{}}{{{}{}{}{}}{}{}{{}}}{{{}{}{}}{}{}{}}}}}{}{{{}{{{}}{}}}}}{{}}{{{}}}{{}{{}{}{}}{}{}{{}}}}{}{{{}{}{{}{{}{{}}}{}}{{}{}}}}}}}}}}}}{{}}{}{}}}{{{{{}{{{}}{}}{}{{{{}}}{}}}{{}{}{{}{}}{}}}}{}{}{}}{{}}}{}{{}}{{{}}{...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Test #46:

score: 25
Accepted
time: 42ms
memory: 7156kb

input:

49951 49949
}|}|}|{{{|{|}{|||||}|{}{|{{{{}||}}{|{|}|}{{{|{}}|{|{||{}{{{}{}||||}||}{{{{|{||{|||}{{|}|{}{{{}|{}}||}{|}}}||}{}|||{{{{{}}{||}||}}||{}}{|}{}}{|{{|}|{}|{}|}}|}|{|{|}{{{}}{|{}|{}}||}}}{{{}}|{{||||||||}{|}}{}}}{{}}}{}{||{}}}}}}}{|||{|{{}|{{{{}|}||||{}}|{|||{||{|{|{|||}{}}|}{{{}|{{{|}|}{{|{}}...

output:

18354 6771 2539 1034 403 141 58 22 6 4 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 49950 tokens

Test #47:

score: 25
Accepted
time: 813ms
memory: 7160kb

input:

49986 49984
}}|}|}}{}}|{}{{{|{}||{|{||}}||}}||}}|{||||{|{}}{|{}|}{{||{|}}{{{||{|}{}}|}{{}{{||{}}{}|{{|||{||{}}}|{}}||}|{||}}{|{|{}|}}{}}}{|{{|}{|{}|{}{{|}}{{}}}{|{{{}|{|}||{|}}{}{}}}|}{}{}{}|}|||{|}|{{}|}}{||}|}{|}}|||{{}{|{}}|}}}|||}}}|{}|{}}{}{{|||||}}{|{|}||}}{|{{{{}}}||{|{|{{{}{{{|{{}{}{|}{||}{}...

output:

23672 8952 3214 1437 522 279 117 56 27 15 7 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 49985 tokens

Test #48:

score: 0
Time Limit Exceeded

input:

49995 49993
{|||||||||}||||||||||||||}|||||||||||||||||||||||||||}}|||||||||||||||||}|||||||{|||||||||||||||{|||||}|{||||||{|||||||||||||||||||||||}|||||||||||||{|||||||{||||||||||||||||||||||{||||}||||||||||{||||||||||||||||||||||{||||||}||||||{||||}}|||||||||{|||||||||||||{||||||||||||||||||||||||...

output:


result:


Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%