CSES - Leirikisa 1 - Results
Submission details
Task:trener
Sender:Kuha
Submission time:2016-07-27 15:03:35 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.13 sdetails
#20.15 sdetails
#30.14 sdetails
#40.14 sdetails
#50.14 sdetails
#60.14 sdetails
#70.14 sdetails
#80.14 sdetails
#90.15 sdetails
#100.15 sdetails
#110.12 sdetails
#120.15 sdetails
#130.13 sdetails
#140.15 sdetails
#150.12 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;
  n = n % m;
  int ans = 0;
  if (!n) cout<<0<<endl;
  else if (n == m) cout<<0<<endl;
  else if (n < m) {
    int l = m;
    ans += n * (l / n);
    l %= n;
    if (!l) ans -= n;
    if (l) {
      if (n % l) {
	ans += l - 1;
      }
      else if (m % l) {
	ans += l - 1;
      }
    }
  }
  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)