답안 #1119003

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1119003 2024-11-26T13:10:55 Z Dan4Life Rack (eJOI19_rack) C++17
100 / 100
146 ms 504 KB
#include <iostream>
using namespace std;
using ll=long long;
ll n,k,l,r,M=1e9+7;
ll p(ll b){
	if(!b)return 1;
	ll x=p(b/2);x*=x;x%=M;
	return (x*(b&1?2:1))%M;
}
main(){
	cin>>n>>k,l=1,r=p(n);
	while(n--){
		if(k%2)k++,r=(r+M-p(n))%M;
		else l=(l+p(n))%M;k/=2;
	}
	cout<<l;
}

Compilation message

rack.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main(){
      | ^~~~
rack.cpp: In function 'int main()':
rack.cpp:14:3: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   14 |   else l=(l+p(n))%M;k/=2;
      |   ^~~~
rack.cpp:14:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   14 |   else l=(l+p(n))%M;k/=2;
      |                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 440 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 440 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 504 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 440 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 504 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 444 KB Output is correct
14 Correct 6 ms 336 KB Output is correct
15 Correct 146 ms 424 KB Output is correct