QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#569642#9308. World CupwcdrAC ✓1ms3808kbC++172.7kb2024-09-17 03:04:232024-09-17 03:04:23

Judging History

你现在查看的是最新测评结果

  • [2024-09-17 03:04:23]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3808kb
  • [2024-09-17 03:04:23]
  • 提交

answer

#include<random>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<ctime>
#include<cctype>
#include<cstdio>
#include<cstdlib>
#include<climits>
//#define NDEBUG
#include<cassert>
#include<cstring>
#include<complex>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<vector>
#include<bitset>
//#define LL __int128
#define LL long long
#define ULL unsigned LL
#define uint unsigned int
//#define int LL
//#define double long double
#define mkp make_pair
#define par pair<int,int>
#define psb push_back
#define epb emplace_back
#define f(x) ((x).first)
#define s(x) ((x).second)
using namespace std;
#define Lbt(x) ((x)&(-(x)))
#define Swap(x,y) (x^=y^=x^=y)
const int Mxxx=1e5;
inline char gc()
{
//	return getchar();
	static char buf[Mxxx],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,Mxxx,stdin),p1==p2)?EOF:*p1++;
}
inline char pc(char ch,bool fl=false)
{
//	return fl?0:putchar(ch),0;
	static char buf[Mxxx],*p1=buf,*p2=buf+Mxxx;
	return (fl||((*p1++=ch)&&p1==p2))&&(fwrite(buf,1,p1-buf,stdout),p1=buf),0;
}
#define output pc('!',true)
inline int read()
{
	char ch=gc();
	int gans=0,gflag=0;
	for(;ch<'0'||'9'<ch;gflag|=ch=='-',ch=gc());
	for(;'0'<=ch&&ch<='9';gans=(gans<<1)+(gans<<3)+(ch^48),ch=gc());
	return gflag?-gans:gans;
}
template<typename T>
inline char read(T&gans)
{
	char ch=gc();
	int gflag=0;gans=0;
	for(;ch<'0'||'9'<ch;gflag|=ch=='-',ch=gc());
	for(;'0'<=ch&&ch<='9';gans=(gans<<1)+(gans<<3)+(ch^48),ch=gc());
	return gans=gflag?-gans:gans,ch;
}
template<typename T>
inline void write(T x)
{
	if(x>9)write(x/10);
	pc(x%10^48);
}
template<typename T>
inline void writenum(T x,char ch)
{
	if(x<0)pc('-'),x=-x;
	write(x);pc(ch);
}
inline void writechar(char x,char ch)
{
	pc(x);pc(ch);
}
template<typename T>
inline T Max(T x,T y)
{
	return x>y?x:y;
}
template<typename T>
inline T Min(T x,T y)
{
	return x<y?x:y;
}
template<typename T>
inline T Abs(T x)
{
	return x<0?-x:x;
}
template<typename T>
inline void ckmx(T&x,T y)
{
	x=Max(x,y);
}
template<typename T>
inline void ckmn(T&x,T y)
{
	x=Min(x,y);
}
int TT;
inline int Slv(int x)
{
	return x<3?32:(x<7?16:(x<14?8:(x<28?4:(x<32?2:1))));
}
int a[33],ps[33],rnk[32];
signed main()
{
	#ifndef ONLINE_JUDGE
	freopen("_.in","r",stdin);
//	freopen("_.out","w",stdout);
	#endif
	int i;
	for(TT=read();TT;TT--)
	{
		for(i=1;i<=32;i++)ps[i]=i,a[i]=read();
		sort(ps+1,ps+1+32,[](int x,int y){return a[x]<a[y];});
		for(i=1;i<=32;i++)rnk[ps[i]]=i;
		writenum(Slv(rnk[1]),10);
	}
	return output;
}
/*
1
32 31 30 29 28 27 26 25 24 23 22 21 20
19 18 17 16 15 14 13 12 11 10 9 8 7 6
5 4 3 2 1
*/

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3644kb

input:

1
32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
2 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
3 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
4 1 2 3 5 6 7 8 9 10 11 12 13 14 15 ...

output:

32
32
16
16
16
16
8
8
8
8
8
8
8
4
4
4
4
4
4
4
4
4
4
4
4
4
4
2
2
2
2
1

result:

ok 32 numbers

Test #3:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

1000
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202 971407775 628894325 731963982 822804784 450968417 430302156 982631932 161735902 880895728 923078537 707723857 189330739 910286918 802329211 404539679 303238506 317063340 492686568 773361868 125660...

output:

16
4
1
4
1
4
4
2
4
2
4
32
4
2
4
4
8
4
32
1
4
4
2
4
2
16
2
8
4
8
8
1
2
4
8
4
16
4
4
2
4
4
2
16
8
4
2
16
4
8
8
4
4
4
4
16
16
2
1
4
4
8
1
4
4
2
4
8
16
4
4
8
4
32
32
8
8
8
1
4
4
4
4
4
32
8
4
4
8
32
4
4
16
2
8
32
16
8
8
4
1
4
4
16
32
4
4
4
4
4
8
4
4
8
4
4
4
8
16
4
4
8
2
4
4
16
2
8
16
4
4
16
2
32
8
16
4
3...

result:

ok 1000 numbers

Extra Test:

score: 0
Extra Test Passed