QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#787800#9670. GG and YY’s Stone GameN_z_AC ✓1ms3732kbC++236.2kb2024-11-27 14:40:232024-11-27 14:40:25

Judging History

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

  • [2024-11-27 14:40:25]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3732kb
  • [2024-11-27 14:40:23]
  • 提交

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)
{
    long long n;
    cin>>n;
    if(n%3==0)cout<<1<<' '<<n/3<<endl;
    else cout<<0<<' '<<n%3+n/3<<endl;
}

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

详细

Test #1:

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

input:

3
1
2
3

output:

0 1
0 2
1 1

result:

ok 3 lines

Test #2:

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

input:

10000
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
10...

output:

0 1
0 2
1 1
0 2
0 3
1 2
0 3
0 4
1 3
0 4
0 5
1 4
0 5
0 6
1 5
0 6
0 7
1 6
0 7
0 8
1 7
0 8
0 9
1 8
0 9
0 10
1 9
0 10
0 11
1 10
0 11
0 12
1 11
0 12
0 13
1 12
0 13
0 14
1 13
0 14
0 15
1 14
0 15
0 16
1 15
0 16
0 17
1 16
0 17
0 18
1 17
0 18
0 19
1 18
0 19
0 20
1 19
0 20
0 21
1 20
0 21
0 22
1 21
0 22
0 23
1...

result:

ok 10000 lines

Test #3:

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

input:

10000
422521
600816
891085
939925
23692
913952
514679
23134
156754
765399
247079
100044
950501
60689
996439
926509
535863
131803
989776
321172
40697
686118
476667
385215
218429
364612
596415
139970
752464
646010
564112
574730
759518
202614
569955
766939
917332
259507
995146
734649
702370
849380
5644...

output:

0 140841
1 200272
0 297029
0 313309
0 7898
0 304652
0 171561
0 7712
0 52252
1 255133
0 82361
1 33348
0 316835
0 20231
0 332147
0 308837
1 178621
0 43935
0 329926
0 107058
0 13567
1 228706
1 158889
1 128405
0 72811
0 121538
1 198805
0 46658
0 250822
0 215338
0 188038
0 191578
0 253174
1 67538
1 18998...

result:

ok 10000 lines

Test #4:

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

input:

10000
38410781692
681926141840
142414535018
910922174803
697649266882
407967245707
629764447166
643520679553
881906972282
957837075938
540132662746
844831978679
511129648742
792987123607
120480134977
206587821263
77708339420
990087691985
170922464925
607059871851
858284711220
239068059894
3545723732...

output:

0 12803593898
0 227308713948
0 47471511674
0 303640724935
0 232549755628
0 135989081903
0 209921482390
0 214506893185
0 293968990762
0 319279025314
0 180044220916
0 281610659561
0 170376549582
0 264329041203
0 40160044993
0 68862607089
0 25902779808
0 330029230663
1 56974154975
1 202353290617
1 2860...

result:

ok 10000 lines

Test #5:

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

input:

10000
1000000000000
999999999999
999999999998
999999999997
999999999996
999999999995
999999999994
999999999993
999999999992
999999999991
999999999990
999999999989
999999999988
999999999987
999999999986
999999999985
999999999984
999999999983
999999999982
999999999981
999999999980
999999999979
9999999...

output:

0 333333333334
1 333333333333
0 333333333334
0 333333333333
1 333333333332
0 333333333333
0 333333333332
1 333333333331
0 333333333332
0 333333333331
1 333333333330
0 333333333331
0 333333333330
1 333333333329
0 333333333330
0 333333333329
1 333333333328
0 333333333329
0 333333333328
1 333333333327
...

result:

ok 10000 lines

Extra Test:

score: 0
Extra Test Passed