Task: | HQ9+ |
Sender: | ArktinenKarpalo |
Submission time: | 2020-11-27 18:13:25 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 15 |
#2 | ACCEPTED | 85 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2 | details |
#2 | ACCEPTED | 0.01 s | 2 | details |
Code
#include <bits/stdc++.h> #define ll long long #define ld long double #define M 1000000007 using namespace std; int t; int d[101010]; char o[101010]; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(); cin >> t; for(int i=0; i<=100000; i++) d[i] = 1e9; d[0] = 0; for(int i=0; i<100000; i++) { // H = 1 if(d[i]+1 < d[i+1]) { d[i+1] = d[i]+1; o[i+1] = 'Q'; } if(d[i]+1 < d[i+494]) { d[i+494] = d[i]+1; o[i+494] = '9'; } // 9 = 494 } for(int g=0; g<t; g++) { int pnt; cin >> pnt; while(pnt > 0) { cout << o[pnt]; if(o[pnt] == '9') pnt -= 494; else pnt--; } cout << "\n"; } }
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
input |
---|
100 10 96 42 77 ... |
correct output |
---|
HHHHHHHHHH HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH... |
user output |
---|
QQQQQQQQQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ... Truncated |
Test 2
Group: 2
Verdict: ACCEPTED
input |
---|
100 76364 26254 35192 92572 ... |
correct output |
---|
999999999999999999999999999999... |
user output |
---|
999999999999999999999999999999... Truncated |