Code Submission Evaluation System Login

Datatähti 2018 alku

Start:2017-10-02 00:00:00
End:2017-10-16 00:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - Datatähti 2018 alku - Results
History
2017-10-15 21:13:2137
2017-10-15 14:45:3037
2017-10-15 00:25:5537
2017-10-15 00:25:170
2017-10-15 00:22:2137
2017-10-15 00:21:5637
2017-10-15 00:21:0537
2017-10-15 00:20:3337
2017-10-15 00:16:1037
2017-10-15 00:15:4737
2017-10-15 00:01:4937
2017-10-14 20:15:5337
2017-10-14 20:02:5137
2017-10-14 20:01:2337
2017-10-14 19:55:4537
2017-10-14 19:38:0037
2017-10-14 19:37:2137
2017-10-14 19:36:2437
2017-10-14 19:33:180
2017-10-14 19:11:2837
2017-10-14 18:20:1237
2017-10-14 18:19:400
2017-10-14 18:07:5137
2017-10-14 16:04:1437
2017-10-14 16:03:0937
2017-10-14 15:57:0637
2017-10-14 15:15:4537
2017-10-14 14:42:1737
2017-10-14 14:42:0137
2017-10-14 14:40:3237
2017-10-14 14:40:1337
2017-10-14 14:39:2137
2017-10-14 14:39:0412
2017-10-14 14:37:3812
2017-10-14 14:37:1312
2017-10-14 14:36:510
2017-10-14 14:35:110
2017-10-14 14:34:0037
2017-10-14 14:33:2637
2017-10-14 14:30:1937
2017-10-14 14:29:3737
2017-10-14 14:27:590
2017-10-14 14:20:3437
2017-10-14 14:05:0337
2017-10-14 14:01:1337
2017-10-14 14:00:5437
2017-10-14 14:00:1137
2017-10-14 13:59:5137
2017-10-13 23:16:0737
2017-10-13 23:14:560
2017-10-13 23:14:1937
2017-10-13 23:12:5437
2017-10-13 23:09:470
2017-10-13 23:09:13
2017-10-13 22:37:320
2017-10-13 22:36:460
2017-10-13 22:34:56
2017-10-13 22:33:55
2017-10-13 22:33:32
2017-10-13 22:32:37
2017-10-13 22:23:5937
2017-10-13 22:16:5637
2017-10-13 22:09:4337
2017-10-13 22:07:4137
2017-10-13 22:07:4037
2017-10-13 21:52:4937
2017-10-13 21:46:5712
2017-10-13 21:46:1312
2017-10-13 21:43:220
2017-10-13 21:42:570
2017-10-13 21:30:2112
2017-10-13 21:07:4812
2017-10-13 21:07:2912
2017-10-13 21:04:4112
2017-10-13 18:56:470
2017-10-13 18:22:450
2017-10-10 22:13:3112
2017-10-10 22:10:130
2017-10-10 22:07:250
2017-10-10 22:06:54
2017-10-10 22:05:390
2017-10-10 20:40:4512
2017-10-10 20:28:410
2017-10-10 20:10:190
2017-10-10 20:08:040
2017-10-07 19:43:360
2017-10-07 19:35:310
2017-10-07 19:28:5812
2017-10-07 13:09:430
2017-10-07 13:06:050
2017-10-07 12:46:530
2017-10-06 21:50:040
2017-10-06 21:34:2912
2017-10-06 21:26:3012
2017-10-06 20:12:2412
2017-10-05 17:58:4312
2017-10-05 11:07:1012
2017-10-05 11:06:520
2017-10-04 21:14:3712
2017-10-04 21:12:4812
2017-10-04 17:41:2712
2017-10-04 17:40:2812
2017-10-04 17:39:59
2017-10-04 17:36:3512
2017-10-03 23:07:320
2017-10-03 22:54:300
2017-10-03 08:28:2312
2017-10-02 22:35:3712
Task:Kyselyt
Sender:Nanohenry
Submission time:2017-10-15 21:13:21
Language:C++
Status:READY
Score:37

Feedback

groupverdictscore
#1ACCEPTED12
#2ACCEPTED25
#3TIME LIMIT EXCEEDED0

Test results

testverdicttime (s)group
#1ACCEPTED0.06 / 1.001details
#2ACCEPTED0.27 / 1.002details
#3TIME LIMIT EXCEEDED-- / 1.003details

Code

#include <iostream>
#include <bits/stdc++.h>

#define dt uint64_t

// uint64_t -> 64 bit variables
// Max value: ~9000000000000000000

using namespace std;

inline dt getDigits(dt value) {
    if (value < 10) {
    	return 1;
    } else if (value < 100) {
    	return 2;
    } else if (value < 1000) {
    	return 3;
    } else if (value < 10000) {
    	return 4;
    } else if (value < 100000) {
    	return 5;
    } else if (value < 1000000) {
    	return 6;
    } else if (value < 10000000) {
    	return 7;
    } else if (value < 100000000) {
    	return 8;
    } else if (value < 1000000000) {
    	return 9;
    } else if (value < 10000000000) {
    	return 10;
    } else if (value < 100000000000) {
    	return 11;
    } else if (value < 1000000000000) {
    	return 12;
    } else if (value < 10000000000000) {
    	return 13;
    } else if (value < 100000000000000) {
    	return 14;
    } else if (value < 1000000000000000) {
    	return 15;
    } else if (value < 10000000000000000) {
    	return 16;
    } else if (value < 100000000000000000) {
    	return 17;
    } else if (value < 1000000000000000000) {
    	return 18;
    }
    return 19;
}

inline dt getDiv(dt value) {
	if (value == 0) {
		return 0;
	} else if (value == 1) {
		return 1;
	} else if (value == 2) {
		return 10;
	} else if (value == 3) {
		return 100;
	} else if (value == 4) {
		return 1000;
	} else if (value == 5) {
		return 10000;
	} else if (value == 6) {
		return 100000;
	} else if (value == 7) {
		return 1000000;
	} else if (value == 8) {
		return 10000000;
	} else if (value == 9) {
		return 100000000;
	} else if (value == 10) {
		return 1000000000;
	} else if (value == 11) {
		return 10000000000;
	} else if (value == 12) {
		return 100000000000;
	} else if (value == 13) {
		return 1000000000000;
	} else if (value == 14) {
		return 10000000000000;
	} else if (value == 15) {
		return 100000000000000;
	} else if (value == 16) {
		return 1000000000000000;
	} else if (value == 17) {
		return 10000000000000000;
	} else if (value == 18) {
		return 100000000000000000;
	}
	return 1000000000000000000;
}

inline dt mod(dt a, dt b) {
    return a - (b * (a / b));
}

inline dt getDigit(dt value, dt index) {
	return mod(value / getDiv(getDigits(value) - index), 10);
}

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	dt amount;
	cin >> amount;
	dt *a = new dt[amount];
	dt cur;
	dt digits;

	for (dt i = 0; i < amount; i++) {
		cin >> a[i];
	}

	for (dt i = 0; i < amount; i++) {
		cur = a[i];
		dt index = 1;
		dt size = 0;
		digits = 0;

		for (; size < cur; index++) {
			digits = getDigits(index);
			size += digits;
		}

		cout << getDigit(index - 1, cur - (size + 1 - digits)) << '\n';
	}
	//while (1);
	return 0;
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
1000
582
214
723
273
480
280
237
204
134
210
565
640
784
508
846
532
465
952
205
...
view   save

correct output
0
1
7
7
6
1
5
4
7
6
2
2
2
2
8
2
1
3
1
8
...
view   save

user output
0
1
7
7
6
1
5
4
7
6
2
2
2
2
8
2
1
3
1
8
...
view   save

Test 2

Group: 2

Verdict: ACCEPTED

input
1000
615664
916441
627600
279508
126605
944125
25887
440405
352957
206746
951305
821686
716797
333476
430123
167570
619834
411383
459670
...
view   save

correct output
1
2
3
2
2
8
7
9
8
3
7
1
9
8
4
3
1
9
9
6
...
view   save

user output
1
2
3
2
2
8
7
9
8
3
7
1
9
8
4
3
1
9
9
6
...
view   save

Test 3

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
1000
672274832941907421
260504693279721732
646999966092970935
100853063389774434
469646937576313460
292789544562527987
202678876957048242
921044261294332160
293497307441838185
889420403130803486
887773296767104352
272588988734184089
900854413164191389
306838570888252671
321818592757748092
632312861733842235
590425060048634753
921705179835679834
711775852688052272
...
view   save

correct output
7
2
2
0
9
7
7
2
0
4
0
3
0
5
9
9
3
1
2
7
...
view   save

user output
(no output)
view   save