Code Submission Evaluation System Login

HIIT Open 2017

Start:2017-05-27 11:00:00
End:2017-05-27 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2017 - Results
History
2017-05-27 14:41:52
2017-05-27 14:24:49
2017-05-27 13:15:45
2017-05-27 13:10:25
Task:Book writing
Sender:oispa opiskelupaikka tefyllä ;...;
Submission time:2017-05-27 14:41:52
Language:C++
Status:READY
Result:ACCEPTED

Test results

testverdicttime (s)
#1ACCEPTED0.04 / 0.50details
#2ACCEPTED0.04 / 0.50details
#3ACCEPTED0.06 / 0.50details
#4ACCEPTED0.06 / 0.50details
#5ACCEPTED0.05 / 0.50details
#6ACCEPTED0.06 / 0.50details
#7ACCEPTED0.05 / 0.50details
#8ACCEPTED0.06 / 0.50details
#9ACCEPTED0.04 / 0.50details
#10ACCEPTED0.04 / 0.50details
#11ACCEPTED0.06 / 0.50details
#12ACCEPTED0.04 / 0.50details
#13ACCEPTED0.05 / 0.50details
#14ACCEPTED0.05 / 0.50details
#15ACCEPTED0.06 / 0.50details

Code

#include <bits/stdc++.h>

using namespace std;
long long n, m;

long long powasdas(long long b, long long e){
    if(e == 0)
        return 1;
    //cout << "taalla fak" << endl;
    long long lol = powasdas(b, e/2);
    lol = (lol*lol)%m;
    if(e%2 == 1){
        lol*=b;
        lol%=m;
    }
    //cout << b << " ^ " << e <<  " = " << lol << endl;
    return lol;
}

long long wtf(long long j){
    long long ans = 1;
    for(long long i = 0; i < j; ++i){
        ans+=2*wtf(i);
    }
    return ans;
}
int main(){
    
    cin >> n >> m;
    long long lol = (powasdas(3, n-1))%m;
    lol = (lol)%m;
    cout << lol << endl;
    //cout << wtf(n) << endl;
    return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
1 1
view   save

correct output
0
view   save

user output
0
view   save

Test 2

Verdict: ACCEPTED

input
1 97
view   save

correct output
1
view   save

user output
1
view   save

Test 3

Verdict: ACCEPTED

input
2 97
view   save

correct output
3
view   save

user output
3
view   save

Test 4

Verdict: ACCEPTED

input
3 97
view   save

correct output
9
view   save

user output
9
view   save

Test 5

Verdict: ACCEPTED

input
1000000000 151663903
view   save

correct output
82561644
view   save

user output
82561644
view   save

Test 6

Verdict: ACCEPTED

input
143596027 174328522
view   save

correct output
28118869
view   save

user output
28118869
view   save

Test 7

Verdict: ACCEPTED

input
147975017 915750433
view   save

correct output
463121246
view   save

user output
463121246
view   save

Test 8

Verdict: ACCEPTED

input
135878271 839118400
view   save

correct output
539995449
view   save

user output
539995449
view   save

Test 9

Verdict: ACCEPTED

input
298512964 952360555
view   save

correct output
580557712
view   save

user output
580557712
view   save

Test 10

Verdict: ACCEPTED

input
529927635 923805382
view   save

correct output
726792503
view   save

user output
726792503
view   save

Test 11

Verdict: ACCEPTED

input
318335201 844538572
view   save

correct output
543761245
view   save

user output
543761245
view   save

Test 12

Verdict: ACCEPTED

input
424831430 113585403
view   save

correct output
11977911
view   save

user output
11977911
view   save

Test 13

Verdict: ACCEPTED

input
365364871 255159067
view   save

correct output
164163032
view   save

user output
164163032
view   save

Test 14

Verdict: ACCEPTED

input
953401405 641246153
view   save

correct output
32288812
view   save

user output
32288812
view   save

Test 15

Verdict: ACCEPTED

input
937783204 624285687
view   save

correct output
213518688
view   save

user output
213518688
view   save