CSES - Aalto Competitive Programming 2024 - wk12 - Wed - Results
Submission details
Task:Text Alignment
Sender:Rasse
Submission time:2024-11-27 17:06:04 +0200
Language:C++ (C++17)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails
#4ACCEPTED0.00 sdetails
#5ACCEPTED0.00 sdetails
#6ACCEPTED0.00 sdetails
#7ACCEPTED0.00 sdetails
#8ACCEPTED0.00 sdetails
#9ACCEPTED0.00 sdetails
#10ACCEPTED0.00 sdetails
#11ACCEPTED0.00 sdetails
#12ACCEPTED0.00 sdetails
#13ACCEPTED0.00 sdetails

Compiler report

input/code.cpp: In function 'void solve()':
input/code.cpp:66:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |     for (int i = 0; i < words.size(); i += 2)
      |                     ~~^~~~~~~~~~~~~~

Code

#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <queue>
#include <climits>
#include <cmath>
#include <functional>
#include <type_traits>
#include <fstream>
#include <bitset>
#include <complex>
#include <iomanip>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // gcc only
template<typename T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, std::less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;
#define int long long
using namespace std;
int p(int base, int power, int mod)
{
if (power == 0)
return 1;
if (power % 2 == 0)
{
int r = p(base, power/2, mod);
return (r*r) % mod;
}
else
return (p(base, power-1, mod)*base) % mod;
}
int LCM(int a, int b)
{
return (a / __gcd(a, b)) * b;
}
int mod = 1e9+7;
void solve()
{
string str;
getline(cin, str);
str += ' ';
vector<string> words;
auto p = str.find(' ');
while (p != string::npos)
{
words.push_back(str.substr(0, p));
str.erase(0, p+1);
p = str.find(' ');
}
for (int i = 0; i < words.size(); i += 2)
{
int spaces = 50 - words[i].size() - words[i+1].size();
string s = string(spaces, ' ');
cout << words[i] << s << words[i+1] << '\n';
}
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t = 1;
//cin >> t;
for (int i = 0; i < t; i++)
{
solve();
//cout.flush();
}
}

Test details

Test 1

Verdict: ACCEPTED

input
zsyadhzdg ke irkyowki nflwfanr...

correct output
zsyadhzdg                     ...

user output
zsyadhzdg                     ...
Truncated

Test 2

Verdict: ACCEPTED

input
eayoylmki efsqdhm qqvnrd npesu...

correct output
eayoylmki                     ...

user output
eayoylmki                     ...
Truncated

Test 3

Verdict: ACCEPTED

input
bsvhdnoxlxad f bclsa llq hjrmp...

correct output
bsvhdnoxlxad                  ...

user output
bsvhdnoxlxad                  ...
Truncated

Test 4

Verdict: ACCEPTED

input
xoezwspspfdzfasgxlqu f wjzpekp...

correct output
xoezwspspfdzfasgxlqu          ...

user output
xoezwspspfdzfasgxlqu          ...
Truncated

Test 5

Verdict: ACCEPTED

input
bwvfj zmcpktjnmhzevcqtvlg twch...

correct output
bwvfj                         ...

user output
bwvfj                         ...
Truncated

Test 6

Verdict: ACCEPTED

input
yifvbbjczpcnpknimq lttkngpeqsz...

correct output
yifvbbjczpcnpknimq            ...

user output
yifvbbjczpcnpknimq            ...
Truncated

Test 7

Verdict: ACCEPTED

input
fu lzslzio ncbkga nrwuijkbrh x...

correct output
fu                            ...

user output
fu                            ...
Truncated

Test 8

Verdict: ACCEPTED

input
azgwjnvgkapltkknwm odostksvqal...

correct output
azgwjnvgkapltkknwm            ...

user output
azgwjnvgkapltkknwm            ...
Truncated

Test 9

Verdict: ACCEPTED

input
j mmadidafwkd dckim iwjy bzsso...

correct output
j                             ...

user output
j                             ...
Truncated

Test 10

Verdict: ACCEPTED

input
barm sykc faxmvycwxs cnxuwpetq...

correct output
barm                          ...

user output
barm                          ...
Truncated

Test 11

Verdict: ACCEPTED

input
ltwg ns j axhacysdjhrpzymwxae ...

correct output
ltwg                          ...

user output
ltwg                          ...
Truncated

Test 12

Verdict: ACCEPTED

input
pgwvxzeztltppuuq siarhxbs mjmr...

correct output
pgwvxzeztltppuuq              ...

user output
pgwvxzeztltppuuq              ...
Truncated

Test 13

Verdict: ACCEPTED

input
xurwjadifyf iijoofrunig zadrff...

correct output
xurwjadifyf                   ...

user output
xurwjadifyf                   ...
Truncated