Task: | Kyselyt |
Sender: | Katajisto |
Submission time: | 2017-10-04 11:39:00 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
#2 | TIME LIMIT EXCEEDED | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | 1 | details |
#2 | TIME LIMIT EXCEEDED | -- | 2 | details |
#3 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:18:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (unsigned long long int t = 1; t <= q; t++) ^ input/code.cpp:40:24: warning: unused variable 'tempnum' [-Wunused-variable] unsigned long long tempnum = num; ^ input/code.cpp:31:22: warning: variable 'nums' set but not used [-Wunused-but-set-variable] unsigned long long nums; ^ input/code.cpp:14:6: warning: unused variable 'wait' [-Wunused-variable] int wait; ^
Code
#include <vector>#include <iostream>#include <string>#include <cstdlib>#include <ctime>#include <stdlib.h>#include <random>using namespace std;unsigned long long int taken = 1;int originalnum;int main(){int wait;int q;cin >> q;vector<unsigned long long int> queries = {};for (unsigned long long int t = 1; t <= q; t++){unsigned long long int tempq;cin >> tempq;queries.push_back(tempq);}for(unsigned long long int query : queries){unsigned long long int i = 1;unsigned long long int num = query;unsigned long long int nextsub = 0;unsigned long long int sub = 1;unsigned long long int region = 1;unsigned long long nums;if (num <= 9){}else{while (num > nextsub){unsigned long long tempnum = num;sub = i * 9 * pow(10, i - 1);nextsub = i * 9 * pow(10, i);if (num - sub > 0){num = num - sub;region++;}else{//cout << "nada" << endl;}//cout << "NUM: " << num << ", SUB: " << sub << endl;i++;}}//cout << "REGION: " << region << " NUMS: " << region * 9 * pow(10, region - 1) << endl;nums = region * 9 * pow(10, region - 1);unsigned long long calc = (num - 1) / region + pow(10, region - 1);//cout << "CALCULATION: " << calc << endl;string result = to_string(calc);unsigned long long pos = (num - 1) % region;//cout << "POS: "<< pos << endl;cout << result[pos] << endl;}}
Test details
Test 1
Group: 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 582 214 723 273 ... |
correct output |
---|
0 1 7 7 6 ... |
user output |
---|
(empty) |
Test 2
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 615664 916441 627600 279508 ... |
correct output |
---|
1 2 3 2 2 ... |
user output |
---|
(empty) |
Test 3
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 672274832941907421 260504693279721732 646999966092970935 100853063389774434 ... |
correct output |
---|
7 2 2 0 9 ... |
user output |
---|
(empty) |