QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#721198 | #8988. Dishonest Lottery | N_z_ | AC ✓ | 1ms | 3784kb | C++23 | 6.3kb | 2024-11-07 15:33:16 | 2024-11-07 15:33:16 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
struct time_helper{
#ifdef LOCAL
clock_t time_last;time_helper(){time_last=clock();}void test(){auto time_now=clock();std::cerr<<"time:"<<1.*(time_now-time_last)/CLOCKS_PER_SEC<<";all_time:"<<1.*time_now/CLOCKS_PER_SEC<<std::endl;time_last=time_now;}~time_helper(){test();}
#else
void test(){}
#endif
}time_helper;
#ifdef LOCAL
#include"dbg.h"
#else
#define dbg(...) (__VA_ARGS__)
#endif
namespace Fread{const int SIZE=1<<16;char buf[SIZE],*S,*T;inline char getchar(){if(S==T){T=(S=buf)+fread(buf,1,SIZE,stdin);if(S==T)return'\n';}return *S++;}}namespace Fwrite{const int SIZE=1<<16;char buf[SIZE],*S=buf,*T=buf+SIZE;inline void flush(){fwrite(buf,1,S-buf,stdout);S=buf;}inline void putchar(char c){*S++=c;if(S==T)flush();}struct NTR{~NTR(){flush();}}ztr;}
#define getchar Fread::getchar
#define putchar Fwrite::putchar
int print_precision=10;bool print_T_endl=1;char print_between=' ';
template<typename T>struct is_char{static constexpr bool value=(std::is_same<T,char>::value||std::is_same<T,signed char>::value||std::is_same<T,unsigned char>::value);};template<typename T>struct is_integral_ex{static constexpr bool value=(std::is_integral<T>::value||std::is_same<T,__int128>::value)&&!is_char<T>::value;};template<typename T>struct is_floating_point_ex{static constexpr bool value=std::is_floating_point<T>::value||std::is_same<T,__float128>::value;};namespace Fastio{struct Reader;struct Writer;template<size_t id>struct read_tuple{template<typename...T>static void read(Reader&stream,std::tuple<T...>&x){read_tuple<id-1>::read(stream,x);stream>>get<id-1>(x);}};template<>struct read_tuple<0>{template<typename...T>static void read([[maybe_unused]]Reader&stream,[[maybe_unused]]std::tuple<T...>&x){}};template<size_t id>struct print_tuple{template<typename...T>static void print(Writer&stream,const std::tuple<T...>&x){print_tuple<id-1>::print(stream,x);putchar(print_between);stream<<get<id-1>(x);}};template<>struct print_tuple<1>{template<typename...T>static void print(Writer&stream,const std::tuple<T...>&x){stream<<get<0>(x);}};template<>struct print_tuple<0>{template<typename...T>static void print([[maybe_unused]]Writer&stream,[[maybe_unused]]const std::tuple<T...>&x){}};
struct Reader{template<typename T>typename std::enable_if_t<std::is_class<T>::value,Reader&>operator>>(T&x){for(auto &y:x)*this>>y;return *this;}template<typename...T>Reader&operator>>(std::tuple<T...>&x){read_tuple<sizeof...(T)>::read(*this,x);return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1;while(c<'0'||c>'9'){if(c=='-')f*=-1;c=getchar();}x=0;while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}x*=f;return *this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1,s=0;x=0;T t=0;while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else return x*=f,*this;while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Reader&>operator>>(T&c){c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();return *this;}Reader&operator>>(char*str){int len=0;char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str[len++]=c,c=getchar();str[len]='\0';return*this;}template<typename T1,typename T2>Reader&operator>>(std::pair<T1,T2>&x){*this>>x.first>>x.second;return *this;}Reader&operator>>(std::string&str){str.clear();char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str.push_back(c),c=getchar();return*this;}Reader(){}}cin;const char endl='\n';
struct Writer{typedef __int128 mxdouble;template<typename T>typename std::enable_if_t<std::is_class<T>::value,Writer&>operator<<(const T&x){for(auto q:x){*this<<q;if(!is_class<decltype(q)>::value)*this<<print_between;}if(!is_class<typename T::value_type>::value&&print_T_endl)*this<<'\n';return *this;}template<typename...T>Writer&operator<<(const std::tuple<T...>&x){print_tuple<sizeof...(T)>::print(*this,x);if(print_T_endl)*this<<'\n';return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Writer&>operator<<(T x){if(x==0)return putchar('0'),*this;if(x<0)putchar('-'),x=-x;static int sta[45];int top=0;while(x)sta[++top]=x%10,x/=10;while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Writer&>operator<<(T x){if(x<0)putchar('-'),x=-x;x+=pow(10,-print_precision)/2;mxdouble _=x;x-=(T)_;static int sta[45];int top=0;while(_)sta[++top]=_%10,_/=10;if(!top)putchar('0');while(top)putchar(sta[top]+'0'),--top;putchar('.');for(int i=0;i<print_precision;i++)x*=10;_=x;while(_)sta[++top]=_%10,_/=10;for(int i=0;i<print_precision-top;i++)putchar('0');while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Writer&>operator<<(const T&c){putchar(c);return*this;}Writer&operator<<(char*str){int cur=0;while(str[cur])putchar(str[cur++]);return *this;}Writer&operator<<(const char*str){int cur=0;while(str[cur])putchar(str[cur++]);return*this;}template<typename T1,typename T2>Writer&operator<<(const std::pair<T1,T2>&x){*this<<x.first<<print_between<<x.second;if(print_T_endl)*this<<'\n';return *this;}Writer&operator<<(const std::string&str){int st=0,ed=str.size();while(st<ed)putchar(str[st++]);return*this;}Writer(){}}cout;}
#define cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl
template<class Fun>class y_combinator_result{Fun fun_;public:template<class T>explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}template<class ...Args>decltype(auto) operator()(Args &&...args){return fun_(std::ref(*this), std::forward<Args>(args)...);}};template<class Fun>decltype(auto) y_combinator(Fun &&fun){return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));}
void init();void solve(int tc);
main()
{
init();int t=1;
// cin>>t;
for(int tc=1;tc<=t;tc++)solve(tc);
}
void init()
{
}
void solve([[maybe_unused]]int tc)
{
int n;
cin>>n;
int cnt[51]={};
for(int x=1;x<=50*n;x++)
{
int a;
cin>>a;
cnt[a]++;
}
bool f=0;
for(int x=1;x<=50;x++)
if(cnt[x]>2*n)cout<<x<<' ',f=1;
if(!f)cout<<-1;cout<<endl;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3724kb
input:
1 32 30 16 45 27 34 45 35 31 42 1 12 26 50 13 34 50 36 21 39 47 7 41 18 45 28 48 2 8 4 16 40 17 2 19 50 4 30 15 6 31 13 33 46 18 49 23 24 17 48
output:
45 50
result:
ok single line: '45 50 '
Test #2:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
1 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
output:
-1
result:
ok single line: '-1'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
1000 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 1 2 3 4 5 6 7...
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
1000 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 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 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 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 1 2 3 4 5 6 7 8 9 10 11 12 13 1...
output:
-1
result:
ok single line: '-1'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
1000 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1...
output:
1 2 3 4 5 6 7 8 9 10
result:
ok single line: '1 2 3 4 5 6 7 8 9 10 '
Test #6:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
1000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1...
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
result:
ok single line: '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 '
Test #7:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
1000 5 8 6 9 7 4 1 5 2 3 19 20 21 18 22 14 16 15 13 12 24 21 1 22 23 21 20 23 24 22 24 3 2 4 1 6 7 8 10 9 1 24 3 2 23 18 20 17 21 19 11 10 9 7 8 20 19 22 23 21 5 7 6 3 4 8 6 7 5 9 7 9 10 6 8 23 21 24 1 22 9 11 12 10 13 18 15 17 16 19 23 24 2 1 22 20 24 21 23 22 2 1 23 3 24 24 4 2 3 1 18 17 16 19 15 ...
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
result:
ok single line: '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 '
Test #8:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
1000 12 27 36 44 37 38 34 16 3 35 33 42 4 38 35 19 6 10 44 47 3 17 12 16 14 40 6 14 3 30 45 9 33 22 38 18 1 35 49 4 46 2 34 31 38 29 3 25 22 26 45 13 42 47 39 1 15 35 18 33 40 32 35 14 41 39 30 1 29 6 11 21 38 10 22 38 13 14 29 49 21 28 29 7 49 24 5 20 30 15 32 46 16 5 29 20 5 50 1 35 40 46 44 33 47...
output:
-1
result:
ok single line: '-1'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
1000 7 36 25 34 41 44 7 2 12 35 33 11 12 8 32 41 18 13 40 3 26 40 36 10 45 44 17 36 42 24 1 39 21 30 50 37 16 36 17 35 49 10 44 13 6 42 46 18 6 35 15 11 2 40 47 37 47 40 42 21 40 17 16 44 8 24 28 41 44 13 21 13 36 41 10 18 43 35 10 34 31 11 48 14 27 4 21 46 15 8 40 31 39 12 21 31 35 24 5 16 39 25 48...
output:
-1
result:
ok single line: '-1'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
1000 21 33 9 34 46 41 11 27 5 18 4 2 50 21 30 49 15 31 24 13 42 49 16 18 40 37 18 29 4 27 39 1 7 45 30 16 50 18 38 49 34 21 3 13 49 47 46 50 35 25 16 41 7 50 2 31 44 5 35 21 4 31 46 11 40 29 8 35 39 17 3 11 22 2 30 11 3 34 48 27 46 12 36 24 16 1 12 3 15 9 30 4 28 47 38 42 18 15 29 24 6 42 41 8 24 35...
output:
-1
result:
ok single line: '-1'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
1000 8 5 17 50 38 9 50 46 10 31 46 32 42 23 9 3 32 23 30 38 16 38 1 30 2 8 31 18 33 36 46 26 19 30 42 41 17 15 5 3 15 49 5 18 28 41 6 31 37 24 32 34 28 39 2 44 8 34 48 13 39 13 41 22 19 38 4 13 11 12 2 33 13 22 7 6 44 1 26 19 45 37 44 6 24 37 43 3 49 13 6 40 19 38 8 15 32 7 2 47 5 2 38 12 42 38 47 3...
output:
-1
result:
ok single line: '-1'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3784kb
input:
1000 41 34 10 40 39 32 45 41 24 23 42 15 34 1 43 45 30 4 11 27 12 14 23 4 21 33 5 36 21 32 36 43 32 20 27 10 11 32 40 44 45 40 27 29 7 24 10 19 25 40 43 40 6 30 18 27 16 47 28 7 38 43 7 3 34 15 37 16 4 13 40 8 45 35 41 8 11 10 4 16 20 14 3 25 17 33 24 6 29 4 14 6 3 33 17 38 9 11 21 37 11 38 18 34 2 ...
output:
-1
result:
ok single line: '-1'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
1000 41 32 4 19 25 31 19 26 43 41 19 30 42 3 5 19 11 20 49 40 3 19 5 33 23 36 49 19 50 42 19 30 33 13 37 19 50 18 35 29 30 19 20 8 44 40 19 26 25 29 14 19 2 23 11 39 32 19 33 37 7 20 22 19 34 1 11 3 19 4 27 23 28 32 19 15 18 42 44 19 20 30 19 31 33 1 30 15 48 19 1 19 21 37 49 35 19 8 6 17 31 9 7 19 ...
output:
19
result:
ok single line: '19 '