Submission #3168284


Source Code Expand

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8101145141919364364;

int main(){
	int t; cin>>t;
	rep(q,t){
		int n,d; cin>>n>>d;
		priority_queue<int,vector<int>,greater<int>>  pq;
		pq.push(d);
		rep(i,n-1){
			int x=pq.top(); pq.pop();
			int y=127^x;
			pq.push(127);
			pq.push(y);
		}
		long long ans=0;
		while(pq.size()){ans+=pq.top();pq.pop();}
		cout<<ans<<endl;
	}
	return 0;
}

Submission Info

Submission Time
Task C - Cookie Breeding Machine
User ChiyosBigDragon
Language C++14 (GCC 5.4.1)
Score 100
Code Size 545 Byte
Status AC
Exec Time 28 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 6
Set Name Test Cases
All 00_sample.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt
Case Name Status Exec Time Memory
00_sample.txt AC 1 ms 256 KB
random_00.txt AC 28 ms 256 KB
random_01.txt AC 28 ms 256 KB
random_02.txt AC 27 ms 256 KB
random_03.txt AC 27 ms 256 KB
random_04.txt AC 27 ms 256 KB