给洛谷填坑的spj……
这里提供了洛谷某些题的$special\ judge$,供需要的oier拿过去对拍.
1.P3825
#include "testlib.h" using namespace std; int n,d;
char num[];
int m;
char ans1[];
int pi,pj,hi,hj;
char opt;
char opt1,opt2;
int main(int argc ,char* argv[]) {
registerTestlibCmd(argc,argv);
n=inf.readInt();
d=inf.readInt();
for(int i=;i<=n;i++) {
while(opt!='x'&&opt!='c'&&opt!='a'&&opt!='b') opt=inf.readChar();
num[i]=opt;
opt=;
}
opt=ans.readChar();
if(opt=='-') {
opt1=ouf.readChar();
if(opt1!='-') quitf(_wa, "On line 1 column 1, read %c, expected -1 . score:QAQ", opt1 );
opt2=ouf.readChar();
if(opt2!='') quitf(_wa, "On line 1 column 2, read %c, expected 1 . score:QWQ", opt2 );
ouf.readEof();
quitf(_ok, "congrdulation Accept answer is -1 score:pwp");
}
opt=;
for(int i=;i<=n;i++) {
opt=ouf.readChar();
if(opt!='A'&&opt!='B'&&opt!='C') quitf(_wa, "On line 1 column %d, read %c, expected A or B or C . score:qwq", i , opt );
ans1[i]=opt;
if(ans1[i]-'A'+'a'==num[i]&&num[i]!='x') quitf(_wa, "On line 1 column %d, unexpect %c, \n the car cannot run in this map . \n score:qaq", i , opt );
opt=;
}
m=inf.readInt();
for(int i=;i<=m;i++) {
opt1=opt2=;
pi=inf.readInt();
while(opt1!='A'&&opt1!='B'&&opt1!='C') opt1=inf.readChar();
pj=inf.readInt();
while(opt2!='A'&&opt2!='B'&&opt2!='C') opt2=inf.readChar();
if(ans1[pi]==opt1&&ans1[pj]!=opt2) quitf(_wa, "cannot accept the limit %d , unexpect %c in map %d score:pvp", i , ans1[pj] ,pj );
}
ouf.readEof();
quitf(_ok, " perfect answer score: qvq" );
return ;
}
P3825
2.P3506
#include "testlib.h"
using namespace std;
//testdata.in
int n,k;
int a[];
char s[];
//testdata.out
int len;
//users.out
int l;int pos;
int num[];
int main(int argc,char *argv[]){
registerTestlibCmd(argc,argv);
n=inf.readInt();
k=inf.readInt();
for(int i=;i<=n;i++) a[i]=inf.readInt();
for(int i=;i<=k;i++) {
s[i]=;
while(s[i]!='>'&&s[i]!='<'&&s[i]!='=')
s[i]=inf.readChar();
}
len=ans.readInt();
l=ouf.readInt();
if(l<len) quitf(_wa,"your answer is smaller than the standard output,expect %d found %d.score:qaq",len,l);
for(int i=;i<=l;i++) {
num[i]=ouf.readInt();
while(a[pos]!=num[i]) {
pos++;
if(pos>n) quitf(_wa,"your sloution isn't a Subsequence of the input,in %d.score:pvp.",i);
}
}
for(int i=;i<l;i++) {
char opt=s[(i-)%k+];
if(opt=='>') {
if(num[i]<=num[i+]) quitf(_wa,"your answer cannot satisfy the condition in %d.score:ovo",i);
}
else if(opt=='<') {
if(num[i]>=num[i+]) quitf(_wa,"your answer cannot satisfy the condition in %d.score:ovo",i);
}
else if(opt=='=') {
if(num[i]!=num[i+]) quitf(_wa,"your answer cannot satisfy the condition in %d.score:ovo",i);
}
}
quitf(_ok,"the answer is correct.score:qwq");
return ;
}
P3506
3.P3493
#include "testlib.h"
using namespace std;
double ous,anf;
int main(int argc,char *argv[]){
registerTestlibCmd(argc,argv);
ous=ouf.readReal();
anf=ans.readReal();
if(abs(ous-anf)<=0.001) {
quitf(_ok,"ok the answer is correct ");
}
else quitf(_wa,"wrong answer found %lf , expect %lf +-0.01",ous,anf);
return ;
}
P3493
4.P3478
#include "testlib.h"
using namespace std;
struct data{
int v;int next;
}edge[];
int alist[];
int cnt;
void add(int u,int v){
edge[++cnt].v=v;
edge[cnt].next=alist[u];
alist[u]=cnt;
return ;
}
int dep[];
long long anss;
long long uout;
int n;
int u,v;
int sroot,uroot;
void dfs(int fa,int x,int de){
dep[x]=de;
for(int nxt=alist[x];nxt;nxt=edge[nxt].next) {
if(edge[nxt].v==fa) continue;
dfs(x,edge[nxt].v,de+);
}
return ;
}
int main(int argc, char *argv[]){
registerTestlibCmd(argc, argv);
n=inf.readInt();
for(int i=;i<n;i++){
u=inf.readInt();
v=inf.readInt();
add(u,v),add(v,u);
}
sroot=ans.readInt();
dfs(,sroot,);
for(int i=;i<=n;i++) anss+=dep[i];
memset(dep,,sizeof(dep));
uroot=ouf.readInt(,n);
dfs(,uroot,);
for(int i=;i<=n;i++) uout+=dep[i];
if(anss>uout) quitf(_wa, "Your answer is less than the correct answer,found %d,expect %d ,score:qwq", uout, anss);
else if(anss==uout) quitf(_ok, "your answer is correct (ying ying ying) ,score:qaq" );
else if(anss<uout) quitp(2.0, "the spj or the data has been attacked ,please connect kkksc03 to fix the data or spj ,score:QAQ" );
return ;
}
P3478
5.P3474
#include "testlib.h"
using namespace std;
long long mp[][];
int n;
long long k,now;
int yy1,xx1,yy2,xx2;
char opt;
int main(int argc,char *argv[]){
registerTestlibCmd(argc,argv);
k=inf.readLong();
n=inf.readInt();
for(int i=;i<=n;i++)
for(int j=;j<=n;j++)
mp[i][j]=inf.readLong();
opt=ans.readChar();
if(opt=='N'){
opt=ouf.readChar();
if(opt!='N') quitf(_wa,"wrong answer ,expect NIE,found %c,score:qwq",opt);
opt=ouf.readChar();
if(opt!='I') quitp(0.2,"wrong answer ,expect IE,found %c,score:qwq",opt);
opt=ouf.readChar();
if(opt!='E') quitp(0.6,"wrong answer ,expect E,found %c,score:qwq",opt);
quitf(_ok,"correct answer ,score:pwp");
}
yy1=ouf.readInt();
xx1=ouf.readInt();
yy2=ouf.readInt();
xx2=ouf.readInt();
for(int i=xx1;i<=xx2;i++)
for(int j=yy1;j<=yy2;j++){
now+=mp[i][j];
}
if(now>*k) quitf(_wa,"your sloution is lager than 2*k.score:pvp");
if(now<k) quitf(_wa,"your sloution is less than k.score:qvq");
quitf(_ok,"ok,correct! score:qaq");
return ;
}
P3474
6.P3022
#include "testlib.h"
using namespace std;
struct data{
int u;int v;
}edge[];
int cnt;
void add(int u,int v){
edge[++cnt].u=u;
edge[cnt].v=v;
return ;
}
int n,m;
int u,v;
int now;
int d[];
bool ins[];
int usr;int anf;
int main(int argc,char* argv[]) {
registerTestlibCmd(argc,argv);
n=inf.readInt();
m=inf.readInt();
// printf("%d %d\n",n,m);
for(int i=;i<=m;i++) {
u=inf.readInt();
v=inf.readInt();
add(u,v);
// printf("%d %d\n",u,v);
}
anf=ans.readInt();
usr=ouf.readInt();
// printf("%d %d\n",anf,usr);
if(anf==-){
if(usr==-) quitf(_ok,"the answer is -1 . score:qaq");
else quitf(_wa,"wa……expect -1 found %d . score:qwq",usr);
}
for(int i=;i<=usr;i++){
now=ouf.readInt(,m);
if(ins[now]==true) quitf(_wa,"your sloution has been retain the edge %d before the operation %d/%d.score: qvq",now,i,usr);
ins[now]=true;
d[edge[now].u]++,d[edge[now].v]++;
}
for(int i=;i<=n;i++) {
if(!d[i]&) quitf(_wa,"the degrees of the point %d isn't an odd ,is %d .score:pvp",i,d[i]);
}
quitf(_ok,"the answer is correct"); return ;
}
P3022
7.P2164
#include "testlib.h"
using namespace std;
const double eps = 0.1;
int n,m;
double a1,a2;
int main(int argc, char *argv[]){
registerTestlibCmd(argc, argv);
n=inf.readInt();
m=inf.readInt();
for(int i=;i<=m;i++) {
a1=ans.readDouble();
a2=ouf.readDouble();
if(abs(a1-a2)>eps) quitf(_wa,"wrong answer on line %d.score:qaq",i);
}
quitf(_ok,"correct answer.score:qwq");
return ;
}
P2164
8.P1871
#include "testlib.h"
//#include <iostream>
using namespace std;
string pos[]={"Success","Already","Conflict","on","with","off"};
int n,m;bool ins[];char opt;int now;//题解部分
int a,b,c;int lst;//多解检验部分
string ous;int cnt;//选手输出部分
string anf;//标准答案部分
int main(int argc,char *argv[])
{
registerTestlibCmd(argc,argv);
n=inf.readInt();m=inf.readInt();
for(int i=;i<=m;i++){
opt=;
while(opt!='-'&&opt!='+') opt=inf.readChar();
now=inf.readInt();
if(opt=='+') {
anf=ans.readToken();ous=ouf.readToken();
// cout<<anf<<endl<<ous<<endl;
if(anf!=ous) quitf(_wa,"wrong answer on operation %d .score:qaq",i);
if(anf==pos[]) ins[now]=true;
else if(anf==pos[]) {
anf=ans.readToken();ous=ouf.readToken();
if(ous!=anf) quitp(0.2,"wrong answer on operation %d,expect on.score:qoq",i);
}
else if(anf==pos[]) {
anf=ans.readToken();ous=ouf.readToken();
if(anf!=ous) quitp(0.2,"wrong answer on operation %d,expect with .score:qoq",i);
cnt=ans.readInt();cnt=ouf.readInt(,n);
if(ins[cnt]!=true) {
quitf(_wa,"on operation %d,the machin %d hasn't been opened .score:qwq",i,cnt);
}
if(__gcd(cnt,now)==){
quitf(_wa,"on operation %d,the machin %d(opened) and the %d(will be opened) are not Conflict,score:pwp",i,cnt,now);
}
}
}
if(opt=='-') {
anf=ans.readToken();ous=ouf.readToken();
if(anf!=ous) quitf(_wa,"wrong answer on operation %d.score:qaq",i);
if(anf==pos[]) ins[now]=false;
if(anf==pos[]) {
anf=ans.readToken();ous=ouf.readToken();
if(anf!=ous) quitp(0.2,"wrong answer on operation %d,expect off.score:qoq",i);
}
}
}
quitf(_ok,"ok,correct answer");
return ;
}
P1871
9.P1248
#include "testlib.h" using namespace std;
int n;
int a[];
int b[];
int sans;int uans;
int num[];
bool ins[];
int now_a;int now_b;
int now_ans;
int main(int argc ,char* argv[]) {
registerTestlibCmd(argc,argv);
n=inf.readInt();
for(int i=;i<=n;i++) a[i]=inf.readInt();
for(int i=;i<=n;i++) b[i]=inf.readInt();
sans=ans.readInt();
uans=ouf.readInt();
if(sans!=uans) {
quitf(_wa, "wrong answer On line 1 column 1, read %d, expected %d. score:qwq", uans, sans);
}
for(int i=;i<=n;i++) num[i]=ouf.readInt(,n),ins[num[i]]=true;
for(int i=;i<=n;i++) if(!ins[i]) quitf(_wa, "your solution cannot slove the product %d.score:qaq",i);
for(int i=;i<=n;i++) {
int now=now_a+a[num[i]];
if(now>now_b) now_b=now+b[num[i]];
else now_b=now_b+b[num[i]];
now_a+=a[num[i]];
}
now_ans=max(now_a,now_b);
if(now_ans==uans) quitf(_ok, "The answer is correct.");
else if(now_ans<uans) quitp( 0.5 , "your sloution is smaller than your min time score:QAQ");
else quitf(_wa, "your sloution is bigger than your min time score:QWQ");
return ;
}
P1248
10.P4293
#include "testlib.h"
using namespace std;
const int maxn = ;
int n;
double m[maxn],c[maxn];
bool oc[maxn];
void rdin(){
n=inf.readInt();
for(int i=;i<=n;i++) {
m[i]=inf.readReal();
c[i]=inf.readReal();
}
return ;
}
double calc ( int a , int b ) { return m[a] * m[b] * ( c[a] - c[b] ) ; }
double cb,ck;
bool idok ( int x ) { return ( x >= and x <= n ); }
void rdout(){
int a,b;a=ouf.readInt();b=ouf.readInt();
if( idok(a) && idok(b) && a != b ) cb = calc( a , b );
else cb = - ; ck = ;
int k,pr;k=ouf.readInt();memset(oc,,sizeof(oc));pr=ouf.readInt();
if(!idok(pr)) { ck = - ; return ;}
oc[pr] = true;
int fr = pr;
int r1a = -, r1b = -, r2a = -, r2b = -;
for(int i=;i<k;i++) {
int x;x=ouf.readInt();
if( !idok(x) || oc[x] ) { ck = - ; return ;}
oc[x]=true;
double tmpc = calc( pr ,x );
ck += tmpc;
if(tmpc < ) {
if (r1a == -) r1a = r1b = i;
else if (i == r1b + ) r1b = i;
else if (r2a == -) r2a = r2b = i;
else if (i == r2b + ) r2b = i;
else { ck = -; return ; }
}
pr = x;
}
ck += calc(pr , fr );
if (r2b == k- && r1a == ) ;
else if (r2a != - ) ck = - ;
return ;
}
void rdas(){
int a,b;a=ans.readInt();b=ans.readInt();
if( idok(a) && idok(b) && a != b ) cb = calc( a , b );
else cb = - ; ck = ;
int k,pr;k=ans.readInt();memset(oc,,sizeof(oc));pr=ans.readInt();
if(!idok(pr)) { ck = - ; return ;}
oc[pr] = true;
int fr = pr;
int r1a = -, r1b = -, r2a = -, r2b = -;
for(int i=;i<k;i++) {
int x;x=ans.readInt();
if( !idok(x) || oc[x] ) { ck = - ; return ;}
oc[x]=true;
double tmpc = calc( pr ,x );
ck += tmpc;
if(tmpc < ) {
if (r1a == -) r1a = r1b = i;
else if (i == r1b + ) r1b = i;
else if (r2a == -) r2a = r2b = i;
else if (i == r2b + ) r2b = i;
else { ck = -; return ; }
}
pr = x;
}
ck += calc(pr , fr );
if (r2b == k- && r1a == ) ;
else if (r2a != - ) ck = - ;
return ;
}
double cb_ans,ck_ans;
void rdans() {
rdas();
cb_ans = cb;
ck_ans = ck;
}
const double eps = 1e-;
bool ok ( double r , double e) {
if( r >= e - eps) return true;
if( r/e >= - eps) return true;
return false;
}
void processout() {
rdout();
int t = ;
if( ok ( cb , cb_ans ) ) t++;
if( ok ( ck , ck_ans ) ) t+=;
if(t == ) quitf(_ok,"ok ,the answer is correct");
else if( t == ) quitp(0.5,"Right 2");
else if( t == ) quitp(0.5,"Right 1");
else quitf(_wa,"wrong answer");
}
int main(int argc,char *argv[]){
registerTestlibCmd(argc,argv);
rdin();
rdans();
processout();
return ;
}
P4293
11.P3596
#include "testlib.h"
using namespace std;
const int maxn = 1e6 + ;
struct in{int u;int v;}qus[maxn << ];
struct data{int v;int next;}edge[maxn<<];int alist[maxn];int cnt;
void add(int u,int v){edge[++cnt].v=v;edge[cnt].next=alist[u];alist[u]=cnt;return ;}
int maxx,xx1,yy1,xx2,yy2;
int minn;int anss;int maxd;int po;int dis[maxn];
void dfs(int x,int fa) {
if(x==xx2&&fa!=yy2) {
int v=yy2;dis[v]=dis[x]+;
if(dis[v]>maxd) maxd=dis[v],po=v;dfs(v,x);
}
if(x==yy2&&fa!=xx2) {
int v=xx2;dis[v]=dis[x]+;
if(dis[v]>maxd) maxd=dis[v],po=v;dfs(v,x);
}
for(int next=alist[x];next;next=edge[next].next) {
if(x==xx1&&edge[next].v==yy1) continue;
if(edge[next].v==xx1&&x==yy1) continue;
if(edge[next].v==fa) continue;
dis[edge[next].v]=dis[x]+;
if(dis[edge[next].v]>maxd) maxd=dis[edge[next].v],po=edge[next].v;
dfs(edge[next].v,x);
}
}
int n,m;int u,v;bool che1,che2;
int main(int argc,char *argv[]){
registerTestlibCmd(argc,argv);
n=inf.readInt();
for(int i=;i<n;i++) u=inf.readInt(),v=inf.readInt(),qus[i].u=u,qus[i].v=v;
anss=ans.readInt();maxx=ouf.readInt();
if(anss<maxx) quitf(_wa,"wrong answer on line 1 cloum 1 ,found %d ,expexct %d.score:qaq",maxx,anss);
xx1=ans.readInt();yy1=ans.readInt();xx2=ans.readInt();yy2=ans.readInt();
xx1=ouf.readInt();yy1=ouf.readInt();xx2=ouf.readInt();yy2=ouf.readInt();
for(int i=;i<n;i++){
if((qus[i].u==xx2&&qus[i].v==yy2)||(qus[i].u==yy2&&qus[i].v==xx2)) {che2=true;continue;}
if((qus[i].u==xx1&&qus[i].v==yy1)||(qus[i].u==yy1&&qus[i].v==xx1)) {che1=true;continue;}
add(qus[i].u,qus[i].v),add(qus[i].v,qus[i].u);}
if(che1!=true||che2==true) quitf(_wa,"your sloution isn't correct .");
dis[] = ;dfs(,);dis[po]=;dfs(po,);
if(maxd!=maxx) quitf(_wa,"wrong answer.the sloution isn't equle to your answer on line 1");
memset(dis,,sizeof(dis));po=;maxd=;memset(edge,,sizeof(edge));memset(alist,,sizeof(alist));
anss=ans.readInt();maxx=ouf.readInt();che1=che2=;
if(anss>maxx) quitf(_wa,"wrong answer on line 2 cloum 1 ,found %d ,expexct %d.score:qaq",maxx,anss);
xx1=ans.readInt();yy1=ans.readInt();xx2=ans.readInt();yy2=ans.readInt();
xx1=ouf.readInt();yy1=ouf.readInt();xx2=ouf.readInt();yy2=ouf.readInt();
for(int i=;i<n;i++){
if((qus[i].u==xx2&&qus[i].v==yy2)||(qus[i].u==yy2&&qus[i].v==xx2)) {che2=true;continue;}
if((qus[i].u==xx1&&qus[i].v==yy1)||(qus[i].u==yy1&&qus[i].v==xx1)) {che1=true;continue;}
add(qus[i].u,qus[i].v),add(qus[i].v,qus[i].u);}
if(che1!=true||che2==true) quitf(_wa,"your sloution isn't correct .");
dis[] = ;dfs(,);dis[po]=;dfs(po,);
if(maxd!=maxx) quitf(_wa,"wrong answer.the sloution isn't equle to your answer on line 2");
quitf(_ok,"the answer is correct");
return ;
}
P3596
12.P3529 等待update
#include "testlib.h"
using namespace std;
const int maxn = ;
int n,m,r,t,k;bool ins[maxn][maxn];
int ouss;int anss;int slo[maxn];int u,v;
struct data{
int id;int pro;int tim;
friend bool operator < (const data &a,const data &b) {return a.tim<b.tim;}
}qwq[maxn];int cnt;int nxt[maxn];
int main(int argc, char *argv[]) {
registerTestlibCmd(argc,argv);
n=inf.readInt();m=inf.readInt();r=inf.readInt();t=inf.readInt();k=inf.readInt();ouss=ouf.readInt();anss=ans.readInt();cnt=ouss;
if(ouss<anss) quitf(_wa,"wrong answer on line 1 cloum 1,expect %d,found %d",anss,ouss);ouss=ouf.readInt();anss=ans.readInt();
if(ouss>anss) quitf(_wa,"wrong answer on line 1 cloum 2,expect %d,found %d",anss,ouss);
for(int i=;i<=k;i++) u=inf.readInt(),v=inf.readInt(),ins[u][v]=true;
for(int i=;i<=cnt;i++) {qwq[i].id=ouf.readInt();qwq[i].pro=ouf.readInt();qwq[i].tim=ouf.readInt();}sort(qwq+,qwq++cnt);
for(int i=;i<=cnt;i++) {
if(nxt[qwq[i].id]>qwq[i].tim) quitf(_wa,"wrong answer on line %d+1,people %d cannot work on time %d",i,qwq[i].id,qwq[i].tim);
if(slo[qwq[i].pro]!=) quitf(_wa,"wrong answer on line %d+1,the problem %d han been sloved before.",i,qwq[i].pro);
if(ins[qwq[i].id][qwq[i].pro]==false) quitf(_wa,"wrong answer on line %d+1,the person %d cannot slove the problem %d.",i,qwq[i].id,qwq[i].tim);
nxt[qwq[i].id]=qwq[i].tim;slo[qwq[i].pro]=qwq[i].tim+r;}
int all = ;
for(int i=;i<=m;i++) all+=slo[i];
if(all==anss) quitf(_ok,"ok the answer is correct ");
else quitf(_wa,"wrong answer,your sloutiion isn't equle to your answer.");
return ;
}
P3529
13.P3520 未完成
//#pragma gcc optimize(2)
#include "testlib.h"
using namespace std;
const int maxn = 1e6 + ;
const int maxm = 2e7 + ;
struct pre{int u;int v;bool val;bool end;}pre[maxm];
struct data{int v;int next;int val;}edge[maxn << ];int alist[maxn];int cnt;
void add(int u,int v,int val)
{edge[++cnt].v=v;edge[cnt].val=val;edge[cnt].next=alist[u];alist[u]=cnt;return ;}
int n,m;int u,v,vals,vale;
void rdin() {
n=inf.readInt();m=inf.readInt();
for(int i=;i<=m;i++)
pre[i].u=inf.readInt(),pre[i].v=inf.readInt(),
pre[i].val=inf.readInt(),pre[i].end=inf.readInt();
return ;
}
char opt;int ouss;int num;bool ins[maxn];int now[maxn];bool inss[maxn];
bool che(int fa,int x,int pos,int now_num) {
if(pos==now_num) return true;bool qaq=false;
for(int next=alist[x];next;next=edge[next].next){
if(edge[next].v==fa) continue ;
if(edge[next].v==now[pos+]) qaq=true,pre[(next+)>>].val^=;
}
if(qaq==true) return che(x,now[pos+],pos+,now_num);
return false;
}
bool work() {
memset(ins,false,sizeof(ins));memset(now,,sizeof(now));num=ouf.readInt();
for(int i=;i<=num+;i++) now[i]=ouf.readInt(),ins[now[i]]=true;
bool book = che(now[num],now[],,num+);
if(!book) return false;
return true;
}
int main(int argc, char *argv[]) {
registerTestlibCmd(argc,argv);opt=ans.readChar();
if(opt=='N') {
opt=ouf.readChar();if(opt!='N') quitf(_wa,"on line 1 cloum 1 ecpect NIE found %c",opt);
opt=ouf.readChar();if(opt!='I') quitf(_wa,"on line 1 cloum 1 ecpect IE found %c",opt);
opt=ouf.readChar();if(opt!='E') quitf(_wa,"on line 1 cloum 1 ecpect E found %c",opt);
quitf(_ok,"ok the answer is correct.");
}
rdin();ouss=ouf.readInt();
for(int i=;i<=m;i++) add(pre[i].u,pre[i].v,pre[i].val),add(pre[i].v,pre[i].u,pre[i].val);
for(int i=;i<=ouss;i++) if(!work()) quitf(_wa,"wrong answer ,your sloution isn't a single ring on line %d+1",i);
for(int i=;i<=m;i++) if(pre[i].val!=pre[i].end) quitf(_wa,"wrong answer ,your sloution cannow slove the road %",i);
quitf(_ok,"ok,the answer is coerrect");
return ;
}
P3520
14.P3516
#include "testlib.h"
#include <ctime>
using namespace std;
struct lb{
int pre,nxt,val;
}x[];
int n,cnt,head,tail;
void ltof(int num)
{
while(num--)
{
int ls=x[tail].pre;
x[ls].nxt=;
x[tail].nxt=head;
x[tail].pre=;
x[head].pre=tail;
head=tail;
tail=ls;
}
}
void ttof(int num)
{
while(num--)
{
int cnt=;
int ls=head;
for(int i=;i<=;i++)
{
ls=x[ls].nxt;
}
int forth=x[ls].nxt;
int kkk=x[ls].pre;
x[forth].pre=kkk;
x[kkk].nxt=x[ls].nxt;
x[ls].pre=;
x[ls].nxt=head;
x[head].pre=ls;
head=ls;
}
}
void change(int num,int cz){
if(cz==) ltof(num);
else ttof(num);
}
char opt;int now;
char pos;
int m;
int main(int argc,char *argv[]) {
registerTestlibCmd(argc,argv);
n=inf.readInt();
for(int i=;i<=n;i++) x[i].val=inf.readInt(),x[i].pre=i-,x[i].nxt=i+;
head=,tail=n;int qnt=;
opt=ans.readChar();
if(opt=='N') {
pos=ouf.readChar();
if(pos!='N') quitf(_wa,"expect NIE found %c.score:pqp",pos);
pos=ouf.readChar();
if(pos!='I') quitf(_wa,"expect IE found %c.score:pqp",pos);
pos=ouf.readChar();
if(pos!='E') quitf(_wa,"expect E found %c.score:pqp",pos);
pos=ouf.readChar();
if(pos=='\n'||pos==||pos==) quitf(_ok,"the answer ios corect .score:qaq");
if(pos!=' ') quitf(_wa,"expect found %c.score:pqp",pos);
pos=ouf.readChar();
if(pos!='D') quitf(_wa,"expect DA found %c.score:pqp",pos);
pos=ouf.readChar();
if(pos!='A') quitf(_wa,"expect A found %c.score:pqp",pos);
pos=ouf.readChar();
if(pos!=' ') quitf(_wa,"expect found %c.score:pqp",pos);
pos=ouf.readChar();
if(pos!='S') quitf(_wa,"expect SIE found %c.score:pqp",pos);
pos=ouf.readChar();
if(pos!='I') quitf(_wa,"expect IE found %c.score:pqp",pos);
pos=ouf.readChar();
if(pos!='E') quitf(_wa,"expect E found %c.score:pqp",pos);
quitf(_ok,"the answer ios corect .score:qaq");
}
m=ouf.readInt(); if(n==&&m==) {quitf(_ok,"correct answer");return ;}
else if(n==) {quitf(_wa,"wrong answer");return ;} for(int i=;i<=m;i++){
pos=;now=;
pos=ouf.readChar();
while(pos>''||pos<'') pos=ouf.readChar();
while(pos<=''&&pos>='') now=now*+pos-'',pos=ouf.readChar();
if(now<=||now>n) quitf(_wa,"wrong output on operation %d,found %d,expect in [ 1 , %d ] .score:vov",i,now,n);
if(pos=='b') now%=;
if(pos=='a') now%=n;
change(now,pos=='b'); }
int wz=head;
while(wz!=tail){
int nxt=x[wz].nxt;
if(x[nxt].val<x[wz].val){
quitf(_wa,"wrong answer");
return ;
}
wz=nxt;
}
if(x[x[tail].pre].val>x[tail].val) quitf(_wa,"worong answer ");
else quitf(_ok,"correct answer ");
return ;
}
P3516
15.P2974
#include "testlib.h"
using namespace std;
const int maxn = ;
const int maxm = ;
string com[]={"ATTACK","MOVE"};
int n,m;char mp[maxn];//testdata.in
struct data{int v;int next;}edge[maxm << ];int alist[maxn];int cnt;
void add(const int &u,const int &v)
{edge[++cnt].v=v;edge[cnt].next=alist[u];alist[u]=cnt;return ;}
string now;int anss;int usrr;//answer compair&&users output
bool ins[maxn];bool att[maxn];bool mov[maxn];int num;
bool unicom(const int &a,const int &b)
{for(int next=alist[a];next;next=edge[next].next) if(edge[next].v==b) return true;else ;return false;}
bool move(const int &a,const int &b) {
if(!unicom(a,b)) return false;
if(mp[a]=='J'&&mp[b]=='E'&&mov[a]==false&&att[a]==false)
mov[a]=true,swap(mp[a],mp[b]),swap(mov[a],mov[b]),swap(att[a],att[b]);
else return false;return true;
}
int attack(const int &a,const int &b) {
if(!unicom(a,b)) return -;
if(mp[a]=='J'&&mp[b]=='T'&&att[a]==false) {
if(ins[b]==false) {ins[b]=true,att[a]=true;return true;}
ins[b]=true,att[a]=true;return ;
}else return -;
}
int u,v;int a,b;int pos;
int main(int argc, char *argv[]) {
registerTestlibCmd(argc,argv);
n=inf.readInt();m=inf.readInt();char opt=;
// for(int i=1;i<=m;i++) qus[i].u=inf.readInt(),qus[i].v=inf.readInt(),add(qus[i].u,qus[i].v),add(qus[i].v,qus[i].u);
for(int i=;i<=m;i++) u=inf.readInt(),v=inf.readInt(),add(u,v),add(v,u);
anss=ans.readInt();usrr=ouf.readInt();
if(anss!=usrr) quitf(_wa,"on line 1 cloum 1 expect %d found %d.score:qaq",anss,usrr);usrr=;
while(usrr!=anss) {
now=ouf.readToken();a=ouf.readInt();b=ouf.readInt();
if(now==com[]) {
int qwq=attack(a,b);
if(qwq==-) quitf(_wa,"wrong sloution ,the cow %d can't attack %d",a,b);
else usrr+=qwq;}
if(now==com[]) if(!move(a,b)) quitf(_wa,"you cannot move %d to %d",a,b);
}
quitf(_ok,"ok,the answer is correct");
return ;
}
//
P2974
16.P2565
#include "testlib.h"
using namespace std;
const double eps = 1e- ;
const int maxn = ;
int as[maxn][maxn];
int a[maxn];
int n,m;
bool pd() {
for(int i=;i<=n;i++) {
int tmp = ;
for(int j = ; j <= m ; j ++ )
for(int k = ; k <= m ; k ++ )
if( as[i][j] > as[a[i]][k] )
tmp++;
if( tmp * <= m * m ) return ;
}
return ;
}
bool ins[];
int main(int argc,char *argv[]){
registerTestlibCmd(argc,argv);
int p1,p2;
p1=ans.readInt();
if(p1 == ) {
p2=ouf.readInt();
if(p1==p2) quitf(_ok,"corrcet answer.score:ovo");
quitf(_wa,"wrong answer,expect 0 ,found %d,score:qaq",p2);
}
n=inf.readInt();
m=inf.readInt();
for(int i=;i<=n;i++) a[i]=inf.readInt();
for(int i=;i<=n;i++)
for(int j=;j<=m;j++){
as[i][j]=ouf.readInt();
if(ins[as[i][j]]==true) quitf(_wa,"on line %d,cloumb %d,the number %d had foung before.score:qwq",i,j,as[i][j]);
ins[as[i][j]]=true;
}
if(pd()) quitf(_ok,"the answer is correct.score:pwp");
else quitf(_wa,"wrong asnwer . score:pvp");
return ;
}
P2565
17.P1253
#include "testlib.h"
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = ;
int n;
long long p[maxn];
long long l[maxn];
long long now[maxn];
long long t[maxn];
long long sums[maxn];
long long sumo[maxn];
long long anss;
long long anso;
void readin(){
// freopen("10.in","r",stdin);
n=inf.readInt();
for(int i=;i<=n;i++) l[i]=inf.readLong(),p[i]=inf.readLong(),now[i]=l[i]*p[i];
// fclose(stdin);
}
void readas(){
// freopen("10.ans","r",stdin);
for(int i=;i<=n;i++) t[i]=ans.readLong();
for(int i=;i<=n;i++) sums[i]=now[t[i]];
for(int i=;i<=n;i++) sums[i]=sums[i-]+sums[i];
for(int i=;i<=n;i++) anss+=sums[i];
// fclose(stdin);
}
void reados(){
// freopen("10.out","r",stdin);
for(int i=;i<=n;i++) t[i]=ouf.readLong();
for(int i=;i<=n;i++) sumo[i]=now[t[i]];
for(int i=;i<=n;i++) sumo[i]=sumo[i-]+sumo[i];
for(int i=;i<=n;i++) anso+=sumo[i];
// fclose(stdin);
}
int main(int argc,char *argv[]){
registerTestlibCmd(argc,argv);
readin();
readas();
reados();
// printf("%lld %lld\n%lld",anss,anso,anss-anso);
if(anss==anso) quitf(_ok,"the answer is correct");
else quitf(_wa,"the minnument time is %d , but your sloution is %d",anss,anso);
return ;
}
P1253
18.P1905 忘了放哪里了qwq找到在贴上吧qwq
给洛谷填坑的spj……的更多相关文章
- 网络流24题 第三题 - CodeVS1904 洛谷2764 最小路径覆盖问题 有向无环图最小路径覆盖 最大流 二分图匹配 匈牙利算法
欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目传送门 - CodeVS1904 题目传送门 - 洛谷2764 题意概括 给出一个有向无环图,现在请你求一些路径,这些路径 ...
- 洛谷P1432 倒水问题(CODEVS.1226)
To 洛谷.1432 倒水问题 题目背景 In the movie "Die Hard 3", Bruce Willis and Samuel L. Jackson were co ...
- 洛谷P1432 倒水问题
题目背景 In the movie "Die Hard 3", Bruce Willis and Samuel L. Jackson were confronted with th ...
- 洛谷P1162—填涂颜色
这应该是是第一次记录洛谷题库里的题目吧: 题目描述 由数字00组成的方阵中,有一任意形状闭合圈,闭合圈由数字11构成,围圈时只走上下左右44个方向.现要求把闭合圈内的所有空间都填写成22.例如:6 \ ...
- #YCB#待做题目与填坑资料
各种填坑资料(qwq) 主席树(by YL)戳 树套树(by ZSY)戳 不要问我这些题咋来的(查大佬的水表呗) 题目列表: [HDU5977]Garden of Eden [BZOJ2752][HA ...
- 洛谷10月月赛II题解
[咻咻咻] (https://www.luogu.org/contestnew/show/11616) 令人窒息的洛谷月赛,即将参加NOIp的我竟然只会一道题(也可以说一道也不会),最终145的我只能 ...
- 不失一般性和快捷性地判定决策单调(洛谷P1912 [NOI2009]诗人小G)(动态规划,决策单调性,单调队列)
洛谷题目传送门 闲话 看完洛谷larryzhong巨佬的题解,蒟蒻一脸懵逼 如果哪年NOI(放心我这样的蒟蒻是去不了的)又来个决策单调性优化DP,那蒟蒻是不是会看都看不出来直接爆\(0\)?! 还是要 ...
- 洛谷 P3178 BZOJ 4034 [HAOI2015]树上操作
题目描述 有一棵点数为 N 的树,以点 1 为根,且树点有边权.然后有 M 个操作,分为三种:操作 1 :把某个节点 x 的点权增加 a .操作 2 :把某个节点 x 为根的子树中所有点的点权都增加 ...
- 洛谷 P1494 BZOJ 2038 [2009国家集训队]小Z的袜子(hose)
//洛谷题面字体.排版我向来喜欢,却还没收录这道如此有名的题,BZOJ的题面字体太那啥啦,清橙的题面有了缩进,小标题却和正文字体一致,找个好看的题面咋这么难呐………… //2019年3月23日23:0 ...
随机推荐
- (K)ubuntu上将分区格式化成NTFS格式
新买了硬盘,装系统时,为Windows预留了几个分区,由于没有其他选择,因此将分区格式化成了fat32格式.装完系统后,总是很纠结,想把这些分区格式化成NTFS格式. google了一下,从这个网址( ...
- ios 单个ViewController屏幕旋转
如果需要旋转的ViewController 使用了UINavigationController,对UINavigationController进行如下扩展 @implementation UINavi ...
- Linux查看用户及分组
cat /etc/group文件包含所有组cat /etc/shadow和cat /etc/passwd系统存在的所有用户名 usermod 或者修改 /etc/passwd文件即可修改当前用户所属组 ...
- Laravel 文件上传失败的问题 error 7
一个站点上传文件失败 error为7 UPLOAD_ERR_CANT_WRITE 临时文件上传不上 $_FILE打出来 Array( [file] => Array ( ...
- Facebook对MySQL全表扫描性能的改进
原文博客如下: http://yoshinorimatsunobu.blogspot.com/2013/10/making-full-table-scan-10x-faster-in.html 如下是 ...
- 不要怂,就是GAN (生成式对抗网络) (一): GAN 简介
前面我们用 TensorFlow 写了简单的 cifar10 分类的代码,得到还不错的结果,下面我们来研究一下生成式对抗网络 GAN,并且用 TensorFlow 代码实现. 自从 Ian Goodf ...
- mysql 更新替换字符串
update zxg set newlevel = REPLACE(newlevel,'b','') 把表zxg中的newlevel字段中的b删除
- Hadoop-2.7.2分布式安装手册
目录 目录 1 1. 前言 3 2. 特性介绍 3 3. 部署 5 3.1. 机器列表 5 3.2. 主机名 5 3.2.1. 临时修改主机名 6 3.2.2. 永久修改主机名 6 3.3. 免密码登 ...
- ros kinect calibration
RGB camera Bring up the OpenNI driver: roslaunch openni_launch openni.launch Now follow the standard ...
- 18-11-1 Scrum Meeting 4
1.会议照片 2.每人的工作 昨天完成的工作 完成测验页面,完善表单验证 完成制定计划,修改计划 关联单词数据,英语单词数据准备 今日计划工作 英文单词的图片准备 完善测验功能 3.项目燃尽图 前端页 ...