提出 #34242009


ソースコード 拡げる

// Ax+Cy+Ez=Xi
// Bx+Dy+Fz=Yi
#include<bits/stdc++.h>
using namespace std;
#define N 100005
const long long mod=998244353;
int n,m;
long long a,b,c,d,e,f,X[N],Y[N],p[305],ans;
map< pair<long,long> ,bool >mp;
bool u[305][305][305];

int main(){
	int i,j,k,x,y,z;
	p[0]=1;
	for(i=1;i<=300;i++){
		p[i]=p[i-1]*3%mod;
	}
	scanf("%d%d",&n,&m);
	ans=p[n];
	scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f);
	for(i=1;i<=m;i++){
		scanf("%lld%lld",&X[i],&Y[i]);
		mp[make_pair(X[i],Y[i])]=1;
	}
	for(x=0;x<=n;x++){
		for(y=0;x+y<=n;y++){
			for(z=0;x+y+z<=n;z++){
				//if(u[x][y][z])continue;
				if(mp.find(make_pair(a*x+c*y+e*z,b*x+d*y+f*z))!=mp.end()){
					ans-=p[n-x-y-z];
					//printf("%d %d %d\n",x,y,z);
					/*for(i=1;i*x<=n;i++){
						for(j=1;j*y<=n;j++){
							for(k=1;k*z<=n;k++){
								u[i*x][j*y][k*z]=1;
								if(z==0)break;
							}
							if(y==0)break;
						}
						if(x==0)break;
					}*/
					ans=(ans+mod)%mod;
					if(ans==0){
						puts("0");
						return 0;
					}
				}				
			}
		}
	}
	printf("%lld",ans);
	return 0;
}

提出情報

提出日時
問題 E - Warp
ユーザ ltx03
言語 C++ (GCC 9.2.1)
得点 0
コード長 1100 Byte
結果 WA
実行時間 64 ms
メモリ 3832 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:8: warning: unused variable ‘j’ [-Wunused-variable]
   13 |  int i,j,k,x,y,z;
      |        ^
./Main.cpp:13:10: warning: unused variable ‘k’ [-Wunused-variable]
   13 |  int i,j,k,x,y,z;
      |          ^
./Main.cpp:18:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   18 |  scanf("%d%d",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~
./Main.cpp:20:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   20 |  scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Main.cpp:22:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   22 |   scanf("%lld%lld",&X[i],&Y[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 500
結果
AC × 3
AC × 22
WA × 8
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
random_01.txt AC 43 ms 3644 KiB
random_02.txt AC 24 ms 3648 KiB
random_03.txt AC 33 ms 3592 KiB
random_04.txt AC 2 ms 3712 KiB
random_05.txt AC 43 ms 3720 KiB
random_06.txt AC 12 ms 3728 KiB
random_07.txt AC 51 ms 3640 KiB
random_08.txt AC 3 ms 3704 KiB
random_09.txt AC 45 ms 3676 KiB
random_10.txt AC 4 ms 3828 KiB
random_11.txt AC 49 ms 3712 KiB
random_12.txt AC 22 ms 3756 KiB
random_13.txt WA 64 ms 3676 KiB
random_14.txt WA 4 ms 3768 KiB
random_15.txt WA 48 ms 3592 KiB
random_16.txt WA 4 ms 3720 KiB
random_17.txt AC 2 ms 3760 KiB
random_18.txt AC 17 ms 3648 KiB
random_19.txt AC 2 ms 3644 KiB
random_20.txt AC 45 ms 3760 KiB
random_21.txt AC 3 ms 3832 KiB
random_22.txt AC 22 ms 3576 KiB
random_23.txt AC 2 ms 3732 KiB
random_24.txt WA 56 ms 3712 KiB
random_25.txt WA 49 ms 3592 KiB
random_26.txt WA 49 ms 3716 KiB
random_27.txt WA 49 ms 3712 KiB
sample_01.txt AC 2 ms 3696 KiB
sample_02.txt AC 2 ms 3636 KiB
sample_03.txt AC 12 ms 3740 KiB