CSES - Datatähti 2022 loppu - Results
Submission details
Task:Kanava
Sender:hltk
Submission time:2022-01-22 16:32:22 +0200
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttimescore
#10.01 s0details

Code

#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  if (t == 1) {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
      string s;
      cin >> s;
      cout << "_";
      for (char c : s) {
        int b = c - 'a';
        for (int j = 0; j < 5; ++j) {
          cout << !!(b & (1 << j));
        }
      }
      cout << endl;
    }
  } else {
    string s;
    cin >> s;
    s += "_";
    string c;
    for (char u : s) {
      if (u == '_') {
        string k;
        for (int i = 0; i < (int) c.size(); i += 5) {
          k.push_back(0);
          for (int j = 0; j < 5; ++j) {
            if (c[i + j] == '1') {
              k.back() += 1 << j;
            }
          }
          k.back() += 'a';
        }
        cout << k << endl;
        c.clear();
      } else {
        c += u;
      }
    }
  }
}

Test details

Test 1

Verdict:

input
1
520
cbmcsyv
uvub
yh
...

correct output
(empty)

user output
ygk
rgzpwpac
ffczhfplny
nwuzdjdj
fxogwcr
...
Truncated