CSES - Leirikisa 1 - Results
Submission details
Task:trener
Sender:Kuha
Submission time:2016-07-27 14:26:28 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.14 sdetails
#20.15 sdetails
#30.14 sdetails
#40.14 sdetails
#50.15 sdetails
#60.13 sdetails
#70.12 sdetails
#80.14 sdetails
#90.14 sdetails
#100.14 sdetails
#110.15 sdetails
#120.14 sdetails
#130.14 sdetails
#140.14 sdetails
#150.14 sdetails

Code

#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define N (1<<17)
#define M 1000000007

using namespace std;

int gcd(int a, int b) {
 if (!b) return a;
return gcd(b, a % b); 
}

int main () {
  int n, m;
  cin>>n>>m;
  if (n == m) cout<<0<<endl;
  else if (n < m) {
    int ans = n * (m % n);
    m -= m % n;
    if (n == m) cout<<ans<<endl;
    else {
	m /= n;
	ans += n * m - n;
	cout<<ans<<endl;
    }
  } else {
    n = n % m;
    if (!n) cout<<0<<endl, exit(0);
    int ans = n * (m % n);
    m -= m % n;
    if (n == m) cout<<ans<<endl;
    else {
	m /= n;
	ans += n * m - n;
	cout<<ans<<endl;
    }
  }
}

Test details

Test 1

Verdict:

input
18
babic
keksic
boric
bukic
...

correct output
bk

user output
(empty)

Test 2

Verdict:

input
6
michael
jordan
lebron
james
...

correct output
PREDAJA

user output
(empty)

Test 3

Verdict:

input
10
wmyrsaney
raqdxrb
cnwkmtcokgskaxosctzyks
wlusaisfibbkwwzdqhezuj
...

correct output
w

user output
(empty)

Test 4

Verdict:

input
20
jgztazpytubijfsmjz
bokvgratzzdibku
qineboilzoqdqivc
bfctyltibtkbxq
...

correct output
b

user output
(empty)

Test 5

Verdict:

input
50
wkrtpgfjmzlnqigogi
knqkkelytfjgmyxgyzcfd
xdkjrptlcuzwqgvrtzdbybh
vscbjbji
...

correct output
efv

user output
(empty)

Test 6

Verdict:

input
100
cmksprocpmkl
deyorcxeehlalonan
tdoqxhvygiwbbklj
rvamqpuprhynwduswppa
...

correct output
dfqrt

user output
(empty)

Test 7

Verdict:

input
130
assootmfjtgcagtxh
elqyysidg
otuxclnjhvxdadm
qmczmsgavvcboahqilzcuzm
...

correct output
abcdefghijklmnopqrstuvwxyz

user output
(empty)

Test 8

Verdict:

input
60
ljuolrxkieqkobvikuyvt
rhbrswllwycioayqjdertvb
xmzcubmbbed
uwgjslybqarciupgixt
...

correct output
eflmnr

user output
(empty)

Test 9

Verdict:

input
5
pnmdjqteyiapkhvebbqtwnnh
pirfyzgoqjsdsio
pkcltfhwxemgyubef
pxcjeh
...

correct output
p

user output
(empty)

Test 10

Verdict:

input
20
fnuxegvwdqnkmkclmwlxeh
kmurkl
rlhxoacqadnzle
foxonevsx
...

correct output
PREDAJA

user output
(empty)

Test 11

Verdict:

input
81
pidkcuqljmxi
mcpwm
zyyjrvkkkwkabwppvpm
aoighmgashjtvl
...

correct output
cegiptuwx

user output
(empty)

Test 12

Verdict:

input
100
evyottlutpqus
openmtwnmme
yvtgrk
shhpzhlgmpnnvswcpmjqiwe
...

correct output
PREDAJA

user output
(empty)

Test 13

Verdict:

input
99
yuqgzaqmnwrghzntlv
mcjkwfrkzchiauues
uclswdwkhtvkcsvklyhyiw
tggmfkr
...

correct output
abeklmnqtvz

user output
(empty)

Test 14

Verdict:

input
4
kzyulnmhnmkowhtgrqksru
xkgzlbwihowzdaodfg
nvxkdrltxviwyhkf
npvivwibxwrludfouga

correct output
PREDAJA

user output
(empty)

Test 15

Verdict:

input
78
qdidvlkgpxjxmuqq
kgbugcncxazixwtxtww
abwtlqxkrusaocu
esjmgrutkzebklqt
...

correct output
ajlstxz

user output
(empty)