Description
如果你遇到了困难,你会怎么做呢?
Solution
睡大觉
Code
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define ull unsigned long long
#define reg register
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(reg int i=a;i<=b;++i)
#define Down(i,a,b) for(reg int i=a;i>=b;--i)
template<typename T>inline void ckmax(T &x,T y){x=x<y?y:x; return ;}
template<typename T>inline void ckmin(T &x,T y){x=x<y?x:y; return ;}
inline int read(){
int res=0,f=1; char k;
while(!isdigit(k=getchar())) if(k=='-') f=-1;
while(isdigit(k)) res=res*10+k-'0',k=getchar();
return res*f;
}
namespace Output{
char OPUT[100];
inline void print(int x){
if(!x) return putchar('0'),putchar(' '),void();
if(x<0) putchar('-'),x=-x;
int cnt=0; while(x) OPUT[++cnt]=x%10,x/=10;
Down(i,cnt,1) putchar(OPUT[i]+'0'); putchar(' '); return ;
}
}using namespace Output;
inline int gcd(int x,int y){return (!y)?x:gcd(y,x%y);}
inline int lcm(int x,int y){return x/gcd(x,y)*y;}
const int mod=998244353;
inline int add(int x,int y,int Mod=mod){return x+y>=Mod?x+y-Mod:x+y;}
inline int del(int x,int y,int Mod=mod){return x-y<0?x-y+Mod:x-y;}
inline int mul(int x,int y,int Mod=mod){return x*y-x*y/Mod*Mod;}
inline void ckadd(int &x,int y,int Mod=mod){x=x+y>=Mod?x+y-Mod:x+y;}
inline void ckdel(int &x,int y,int Mod=mod){x=x-y<0?x-y+Mod:x-y;}
inline void ckmul(int &x,int y,int Mod=mod){x=x*y-x*y/Mod*Mod;}
inline int ksm(int x,int y,int Mod=mod){int res=1; for(;y;y>>=1,ckmul(x,x,Mod)) if(y&1) ckmul(res,x,Mod); return res;}
inline void approx(int val,int Mod=mod,int lim=1e5){int x=val,y=Mod,a=1,b=0; while(x>lim){swap(x,y); swap(a,b); a-=x/y*b; x%=y;} cout<<x<<"/"<<a<<endl; return ;}
const double pi=acos(-1);
struct Complex{
double x,y; Complex(){}
Complex(double xx,double yy){x=xx; y=yy; return ;}
Complex operator +(const Complex &a)const{return Complex(x+a.x,y+a.y);}
Complex operator -(const Complex &a)const{return Complex(x-a.x,y-a.y);}
Complex operator *(const Complex &a)const{return Complex(x*a.x-y*a.y,x*a.y+y*a.x);}
};
inline pair<Complex,Complex> square_root(Complex a){
double len=sqrt(a.x*a.x+a.y*a.y); len=sqrt(len);
double ang=atan2(a.y,a.x),a1=ang/2+pi,a2=ang/2; if(a2<0) a2+=2*pi;
return mp(Complex(cos(a1)*len,sin(a1)*len),Complex(cos(a2)*len,sin(a2)*len));
}
inline double cross(Complex a,Complex b){return a.x*b.y-a.y*b.x;}
struct fractor{
int x,y; fractor(){}
fractor(int xx,int yy){x=xx; y=yy; return ;}
fractor operator+(const fractor &a)const{
int mu=lcm(y,a.y),zi=x*(mu/y)+a.x*(mu/a.y);
int g=gcd(mu,zi); return fractor(zi/g,mu/g);
}
fractor operator*(const fractor &a)const{
int gg=gcd(y,a.x)*gcd(x,a.y);
return fractor(x*a.x/gg,y*a.y/gg);
}
bool operator <(const fractor &a)const{
int da=x/y,db=a.x/a.y; if(da^db) return da<db;
fractor t1=fractor(x-y*da,y),t2=fractor(a.x-a.y*db,a.y);
return t1.x*t2.y<t2.x*t1.y;
}
};
inline int random(int x){return 1ll*rand()*rand()%x+1;}
inline int random(int l,int r){return 1ll*rand()*rand()%(r-l+1)+l;}
namespace Graph_Maker{
set<pair<int,int> >st;
inline void insert(int x,int y){
if(x>y) swap(x,y); st.insert(mp(x,y)); return ;
}
inline bool check(int x,int y){
if(x>y) swap(x,y); if(st.count(mp(x,y))) return 0;
return 1;
}
inline void work(int n,int m){
print(n); print(m); puts("");
rep(i,1,n-1){
int x=random(i),y=i+1;
print(x); print(y); puts("");
insert(x,y);
}
rep(i,n,m){
int x=random(1,n-1),y=random(x+1,n);
while(!check(x,y)) x=random(1,n-1),y=random(x+1,n);
insert(x,y); print(x); print(y); puts("");
} return ;
}
}
signed main(){
srand((unsigned)time(0));
system("g++ my.cpp -o my.out -std=c++11 -O2 -lm -Wall"); puts("My Code Compilation Finished");
system("g++ std.cpp -o std.out -std=c++11 -O2 -lm -Wall"); puts("Std Code Compilation Finished");
system("g++ mkd.cpp -o mkd.out -std=c++11 -O2 -lm -Wall"); puts("Data Maker Compilation Finished");
for(reg int TestCaseIdx=1;;){
system("./mkd.out>1.in");
system("./my.out<1.in>my.ans");
system("./std.out<1.in>std.ans");
if(system("diff my.ans std.ans")) puts("Wrong Answer"),exit(0);
else printf("遇到困难睡大觉! for %lld times
",++TestCaseIdx);
} return 0;
}
Review
遇到困难睡大觉!