結果

問題 No.250 atetubouのzetubou
ユーザー xxxasdfghjk
提出日時 2018-09-11 22:38:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 2,550 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 73,768 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-24 08:37:13
合計ジャッジ時間 6,271 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int ncrset()’:
main.cpp:53:1: warning: no return statement in function returning non-void [-Wreturn-type]
   53 | }
      | ^

ソースコード

diff #
プレゼンテーションモードにする

#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#define MAX_N 100001
#define INF 2147483647
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
typedef long long int ll;
struct edge{
int from,to,cost;
};
typedef vector<vector<edge> > AdjList;
AdjList graph;
typedef pair<int , int> P;
bool comp(const edge& e1, const edge& e2){
return e1.cost < e2.cost;
}
int E,V;
edge es[100001];
int kruskal(){
sort(es,es+E,comp);
init(V);
int res = 0;
for(int i=0;i<E;i++){
edge e = es[i];
if(!same(e.to,e.from)){
unite(e.to,e.from);
res += e.cost;
}
}
return res;
}
long long int MOD = 1000000007;
long long int ruiseki[200001];
int ncrset(){
ruiseki[0] = 1;
for(int i=1;i<200001;i++){
ruiseki[i] = (ruiseki[i-1] * i) % MOD;
}
}
long long int powld(long long int x,long long int n){
long long int ans = 1;
while(n > 0){
if((n&1) == 1){
ans = (ans*x) % MOD;
}
x = (x*x) % MOD;
n >>= 1;
}
return ans % MOD;
}
int ncrgyaku(int n,int r){
long long int gyakuk,gyakur;
long long int res = 1,x,y,z;
y = powld(ruiseki[r],MOD-2);
z = powld(ruiseki[n-r],MOD-2);
return (((ruiseki[n]*y) % MOD)*z) % MOD;
}
int main()
{
ll N,K,Q,D,X,T,ncr[3001][3001];
bool jud[3001][3001];
REP(i,3001)REP(j,3001)jud[i][j] = false;
ncrset();
REP(i,3001){
ncr[i][0] = 1;
ncr[i][i] = 1;
}
REP(i,3000){
REP(j,3000){
if(jud[i][j+1] || jud[i][j])
jud[i+1][j+1] = true;
else{
ncr[i+1][j+1] = ncr[i][j+1]+ncr[i][j];
if(ncr[i+1][j+1] >= 1000000000000000){
jud[i+1][j+1] = true;
}
}
}
}
cin >> Q;
REP(i,Q){
cin >> D >> X >> T;
if(jud[X+D-1][X] || ncr[X+D-1][X] > T)
cout << "ZETUBOU" << endl;
else
cout << "AC" << endl;
}
return 0;
}
int par[MAX_N];
int ranks[MAX_N];
//n
void init(int n){
REP(i,n){
par[i] = i;
ranks[i] = 0;
}
}
//
int find(int x){
if(par[x] == x){
return x;
}else{
return par[x] = find(par[x]);
}
}
void unite(int x,int y){
x = find(x);
y = find(y);
if(x == y) return ;
if(ranks[x] < ranks[y]){
par[x] = y;
}else{
par[y] = x;
if(ranks[x] == ranks[y]) ranks[x]++;
}
}
bool same(int x, int y){
return find(x) == find(y);
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0