답안 #240336

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
240336 2020-06-19T13:05:16 Z blacktulip XORanges (eJOI19_xoranges) C++17
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long lo;
typedef pair< lo,lo > PII;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
 
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
 
int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> v;

inline int mul(int x,int y){
	return (x%mod)*(y%mod)%mod;
}

inline int add(int x,int y){
	if(x+y>=mod)return x+y-mod;
	return x+y;
}

inline int fp(int x,int y){
	if(y==0)return 1;
	if(y==1)return x;
	int tt=fp(x,y/2);
	tt=mul(tt,tt);
	if(y%2==1)tt=mul(tt,x);
	return tt;
}

main(void){
	//~ freopen("rack.gir","r",stdin);
	//~ freopen("rack.cik","w",stdout);
	scanf("%lld %lld",&n,&m);
	while(m>1){
		//~ m--;
		v.pb((m%2));
		//~ if(m/2==0)break;
		m=(m+1)/2;
	}
	int bas=1;
	int say=n-1;
	//~ reverse(v.begin(),v.end());
	for(int i=0;i<(int)v.size();i++){
		if(v[i]==0)bas=add(bas,fp(2,say));
		say--;
		//~ cout<<bas<<" "<<son<<endl;
	}
	printf("%lld\n",bas%mod);
	return 0;
}

Compilation message

xoranges.cpp:49:10: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(void){
          ^
xoranges.cpp: In function 'int main()':
xoranges.cpp:52:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -