Task: | Ruudukko |
Sender: | Epe |
Submission time: | 2019-10-02 00:17:27 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | details |
#2 | WRONG ANSWER | 0.01 s | details |
#3 | WRONG ANSWER | 0.01 s | details |
#4 | WRONG ANSWER | 0.01 s | details |
#5 | WRONG ANSWER | 0.01 s | details |
#6 | WRONG ANSWER | 0.01 s | details |
Compiler report
input/code.cpp: In function 'int lower(int, int, int)': input/code.cpp:8:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ input/code.cpp: In function 'int main()': input/code.cpp:46:26: warning: variable 'found' set but not used [-Wunused-but-set-variable] bool found = false; ^~~~~
Code
#include <bits/stdc++.h> using namespace std; vector<unsigned long long> seen(1000); int lower(int target, int mid, int rad){ } int digits(int input){ return ceil(log10(input+1)); } unsigned long long parse(int input){ if(seen[input] != 0){ return seen[input]; } unsigned long long temp = 0; for(int i = 0; input > 0; i++){ temp+=(input%2)*(int)pow(10,i); input/=2; } seen[input] = temp; return temp; } int main(){ for(int i = 0; i < 1000; i++){ seen[i] = parse(i); } int amount; cin >> amount; vector<long long> counts; for(int l = 0; l < amount; l++){ long a,b; cin >> a >> b; if(a!=0) { for (long i = 1; i < pow(2, 12); i *= 2) { long dig = parse(i); if (dig > a) { bool found = false; for (int s = i+1; s > 0; s--) { long temp = parse(s); if (temp < a) { a = s + 1; found = true; break; } } break; } } } if(b != 0) { for (long i = 1; i < pow(2, 12); i *= 2) { long dig = parse(i);//pow? if (dig > b) { for (int s = i; s >= 0; s--) { long temp = parse(s); if (temp <= b) { b = s; break; } } break; } } } counts.push_back((b-a)+1); } for(int i = 0; i < amount; i++){ cout << counts[i] << endl; } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
1 |
correct output |
---|
1 |
user output |
---|
-23456232240263 |
Test 2
Verdict: WRONG ANSWER
input |
---|
2 |
correct output |
---|
1 2 2 1 |
user output |
---|
-23456232240263 -23456232240263 |
Test 3
Verdict: WRONG ANSWER
input |
---|
5 |
correct output |
---|
1 2 3 4 5 2 1 4 3 6 3 4 1 2 7 4 3 2 1 8 5 6 7 8 1 |
user output |
---|
-23456232240263 -23456232240263 -23456232240263 -23456232240263 -23456232240263 |
Test 4
Verdict: WRONG ANSWER
input |
---|
42 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
-23456232240263 -23456232240263 -23456232240263 -23456232240263 -23456232240263 ... Truncated |
Test 5
Verdict: WRONG ANSWER
input |
---|
99 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
-23456232240263 -23456232240263 -23456232240263 -23456232240263 -23456232240263 ... Truncated |
Test 6
Verdict: WRONG ANSWER
input |
---|
100 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
-23456232240263 -23456232240263 -23456232240263 -23456232240263 -23456232240263 ... Truncated |