QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#73121#2903. Tetris Generationqdd#AC ✓7ms3476kbC++201.1kb2023-01-22 12:08:292023-01-22 12:08:30

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-22 12:08:30]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:3476kb
  • [2023-01-22 12:08:29]
  • 提交

answer

// qdd on Jan 21, 2023

#ifdef qdd
#include <ringo>
#else
#include <bits/stdc++.h>
#define dbg(...)
#define dbgr(x, y)
#endif

using namespace std;

using ll = long long;

#define ALL(x) begin(x), end(x)

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v) is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  bool f = 0;
  for (const T& x : v) (f ? os << ' ' : os) << x, f = 1;
  return os;
}

void sol() {
  string s;
  cin >> s;
  int n = s.size();
  auto check = [&](int i) {
    int j = 0, cnt = 0;
    while (j < n) {
      set<char> S;
      while (j < n && cnt < i) {
        cnt++;
        S.insert(s[j]);
        j++;
      }
      if (S.size() != cnt) return false;
      cnt = 0;
      i = 7;
    }
    return true;
  };

  for (int i = 0; i < 7; i++) {
    if (check(i)) {
      cout << "1\n";
      return;
    }
  }
  cout << "0\n";
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) {
    sol();
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3476kb

input:

2
JJTO
JJTT

output:

1
0

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 2ms
memory: 3388kb

input:

1
O

output:

1

result:

ok single line: '1'

Test #3:

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

input:

2
JLSZIOTTOIZSLJ
JLSZIOJLSZIOT

output:

1
1

result:

ok 2 lines

Test #4:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

7
ZSTIOILZOTSJJLIOTSZSTIZOLJSTLOJZITSIJLZOIZSJOLTTJLSZOISOIZLJTTJOSILZZITOSJLTLIZOSJSJOLTIZSOITZJLLIJSTOZOSIJTLZITLOSZJTSZILJOJZSOTLIITOLZJSZTLJISOSJLTZOIZOLISJTSILZJOTOZTJISLLZOJTSISJTILOZTIJZSOLISOZJTLITLOSZJIZJOTSLTSZILJOTIJLZOSTLZOJSIOSJTLZISZLJTIOITLOSZJSOIJZLTLJSTOIZSOZJITLLISJOTZTJOILSZLTJZIS...

output:

1
1
1
1
1
1
1

result:

ok 7 lines

Test #5:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

3
ZSTIOILZOTSJJLIOTSZSTIZOLJSTLOJZITSIJLZOIZSJOLTOJLSZOISOIZLJTTJOSILZZITOSJLTLIZOSJSJOLTIZSOITZJLLIJSTOZOSIJTLZITLOSZJTSZILJOJZSOTLIITOLZJSZTLJISOSJLTZOIZOLISJTSILZJOTOZTJISLLZOJTSISJTILOZTIJZSOLISOZJTLITLOSZJIZJOTSLTSZILJOTIJLZOSTLZOJSIOSJTLZISZLJTIOITLOSZJSOIJZLTLJSTOIZSOZJITLLISJOTZTJOILSZLTJZIS...

output:

0
1
0

result:

ok 3 lines

Test #6:

score: 0
Accepted
time: 6ms
memory: 3404kb

input:

100
TOISIZOLSJTLZTOSIJLTZSJOILOSTZJIOLJZTISZIOLTJSJZLTOISLTOIZJSZLITOSJSTZJOILOSLZITJOJTIZLSSOITJZLLOTJISZZSITJLOZTLJISOIOTSLJZZOTISLJLISOTJZLZJSOITZSIJLTOLSJIOTZJTOZSLILJTIOZSLOZTSJITJZIOLSLOSTJIZSLOJTZIZSOIJTLIOTJZSLIZJOLSTSJLITOZSJITZOLJLTZSOIIJOTZLSIZOSTJLISOJTZLLOIJSZTZILSOJTOZILSTJTOLSZIJSOZJI...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

result:

ok 100 lines

Test #7:

score: 0
Accepted
time: 7ms
memory: 3416kb

input:

1000
OTSZILILJZOTSSLTOJIZTZLSIJOOLSITJZSOIZTLJTOISLJZJTLIOSZSJTILZOLZSJOTIJILSOTZIZLOJSTTSIOJLZJISZLTOZST
SLIJSZTLOLSZJITOOZTIJSLLJTIZOSOLZISJTZSOJTILLSTOIZJOITJLZSSJILTOZSZLJOTILSOTZJITJZOLSIOJSLTIZSLIOZTJ
TOLJZTIOSOTIZSJLISOLTZJOZILSJTJLTSOIZTZOJILSIOTSZLJOJTSLZIZLJTSIOTISJOLZJTSLIOZILSTZJOOSZTIJL...

output:

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

result:

ok 1000 lines