QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#626927#7042. So EasyN_z_AC ✓9ms7156kbC++236.3kb2024-10-10 14:03:102024-10-10 14:03:11

Judging History

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

  • [2024-10-10 14:03:11]
  • 评测
  • 测评结果:AC
  • 用时:9ms
  • 内存:7156kb
  • [2024-10-10 14:03:10]
  • 提交

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;
	vector<vector<int>>a(n,vector<int>(n));
	cin>>a;
	for(int x=0;x<n;x++)
	for(int y=0;y<n;y++)
	if(a[x][y]==-1)
	{
		cout<<a[(x+1)%n][y]+a[x][(y+1)%n]-a[(x+1)%n][(y+1)%n]<<endl;
		return;
	}
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 2 1
0 -1 0
0 1 0

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

10
63 66 64 39 41 64 67 46 45 56
67 70 68 43 45 68 71 50 49 60
72 75 73 48 50 73 76 55 54 65
64 67 65 40 42 65 68 47 46 57
81 84 82 57 59 82 85 64 63 74
43 46 44 19 21 44 47 26 25 36
45 48 46 21 23 -1 49 28 27 38
70 73 71 46 48 71 74 53 52 63
57 60 58 33 35 58 61 40 39 50
81 84 82 57 59 82 85 64 63 74

output:

46

result:

ok 1 number(s): "46"

Test #3:

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

input:

100
36 58 36 31 46 52 39 42 28 35 54 32 31 37 37 36 30 32 27 41 44 39 45 42 57 40 35 43 40 36 40 29 71 38 40 45 46 31 31 44 52 44 66 38 56 40 35 28 37 27 28 33 37 35 27 41 34 55 34 67 57 45 44 35 27 29 47 37 51 43 46 30 32 50 48 59 50 35 37 40 43 44 38 27 48 34 31 45 35 36 44 37 55 35 37 34 40 54 31...

output:

32

result:

ok 1 number(s): "32"

Test #4:

score: 0
Accepted
time: 8ms
memory: 7136kb

input:

1000
72 98 15 95 62 91 0 49 0 0 0 0 31 34 0 62 0 59 155 0 57 0 24 0 0 118 84 74 0 118 92 0 151 172 55 97 0 0 0 39 0 0 27 149 0 0 73 0 93 77 0 0 0 0 0 0 0 18 0 0 62 0 154 147 184 0 34 99 122 78 0 96 48 0 0 95 85 0 94 0 262 0 138 0 42 0 192 186 0 0 71 61 60 80 0 59 90 0 0 93 79 92 51 146 42 161 0 80 8...

output:

14

result:

ok 1 number(s): "14"

Test #5:

score: 0
Accepted
time: 6ms
memory: 6780kb

input:

946
190332 496619 233226 513372 173426 473056 564990 436822 408812 196269 147901 258053 272675 380312 583582 339352 451363 538533 311062 404021 262637 458875 446837 383779 273156 227142 394125 405113 281125 335122 307196 347525 577796 333796 252513 423799 417315 203820 311700 300052 482305 140348 14...

output:

565344

result:

ok 1 number(s): "565344"

Test #6:

score: 0
Accepted
time: 3ms
memory: 6600kb

input:

924
250813 383230 167179 217308 214822 505276 202168 470854 308435 122003 277101 504050 298746 577234 502827 373238 272318 587439 330133 443002 237378 531448 322760 578450 230169 480966 149815 458363 292321 310182 314544 119703 524194 600506 474630 172241 385462 165132 152397 558997 590162 152448 17...

output:

596615

result:

ok 1 number(s): "596615"

Test #7:

score: 0
Accepted
time: 9ms
memory: 6716kb

input:

970
770001 578818 868816 825733 578120 900691 839349 950668 612547 952228 906303 613241 729306 665718 922074 757394 634570 540832 794986 981985 657902 604021 603173 760197 769773 543765 864214 874807 612493 743950 767676 700859 820863 676191 547017 825173 758097 585152 897584 859236 602507 890936 70...

output:

824274

result:

ok 1 number(s): "824274"

Test #8:

score: 0
Accepted
time: 4ms
memory: 6488kb

input:

915
652381 733110 583374 351568 441416 337397 339720 752379 334069 645642 398695 681137 577276 725832 800025 600254 414232 452931 677250 384158 537130 581081 342289 454868 631274 565270 441803 695737 486882 540910 596923 377524 589161 806094 536815 436808 630730 463876 505961 576886 656146 724935 68...

output:

459171

result:

ok 1 number(s): "459171"

Test #9:

score: 0
Accepted
time: 9ms
memory: 6896kb

input:

961
212861 524209 421814 459991 482812 274105 435605 232191 596886 517158 432383 372914 549128 273021 623757 538627 680970 406324 559513 423139 470577 558141 622701 636614 534069 223580 601981 612180 265758 474676 550052 554190 481341 381777 704714 685251 407851 425188 292439 281610 668490 504715 61...

output:

360088

result:

ok 1 number(s): "360088"

Test #10:

score: 0
Accepted
time: 6ms
memory: 7156kb

input:

974
567390 396965 573671 731557 441168 526496 307260 769003 330617 458895 671904 494270 289439 398373 461384 461200 510714 463249 328465 525031 714776 562893 296161 341634 717828 483663 581313 476404 766770 396074 574589 640551 559604 572852 290573 695049 458208 404840 352432 565107 651163 331134 73...

output:

533739

result:

ok 1 number(s): "533739"

Test #11:

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

input:

2
-1 2
3 4

output:

1

result:

ok 1 number(s): "1"

Test #12:

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

input:

2
1 -1
3 4

output:

2

result:

ok 1 number(s): "2"

Test #13:

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

input:

2
1 2
-1 4

output:

3

result:

ok 1 number(s): "3"

Test #14:

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

input:

2
1 2
3 -1

output:

4

result:

ok 1 number(s): "4"