CSES - Datatähti 2021 loppu - Results
Submission details
Task:Suuremmat
Sender:Eljas
Submission time:2021-01-23 17:31:33 +0200
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED35
#2ACCEPTED65
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2details
#2ACCEPTED0.01 s2details

Code

#include <iostream>
#include <vector>
#include <string>
#define ll long long
int main()
{
	 int n = 0;
	 std::cin >> n;

	 std::vector<ll> vec(n);
	 for (int i = 0; i < n; i++)
	 {
		  std::cin >> vec[i];
	 }

	 std::string s;
	 std::string s1;
	 std::string s2;
	 std::string s3;
	 char first;
	 int length;

	 for (int i = 0; i < n; i++)
	 {
		  ll x = vec[i];
		  s = std::to_string(x);
		  length = s.length();
		  first = s[0];


		  s1 = std::string(length, first);
		  s2 = std::string(length, first + 1);
		  s3 = std::string(length + 1, '1');

		  if (std::stoll(s1) > x)
		  {
				std::cout << s1;
		  }
		  else if (first < '9' && std::stoll(s2) > x) {
				std::cout << s2;
		  }
		  else {
				std::cout << s3;
		  }

		  std::cout << '\n';
	 }




}

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

input
1000
1
2
3
4
...

correct output
2
3
4
5
6
...

user output
2
3
4
5
6
...
Truncated

Test 2

Group: 2

Verdict: ACCEPTED

input
1000
735425311146082632
756615631808964686
466489470801941584
100417544394053220
...

correct output
777777777777777777
777777777777777777
555555555555555555
111111111111111111
555555555555555555
...

user output
777777777777777777
777777777777777777
555555555555555555
111111111111111111
55555555555555
...
Truncated