QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#346965#8340. 3 Sumucup-team1004#WA 153ms4108kbC++142.1kb2024-03-09 09:03:362024-03-09 09:03:37

Judging History

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

  • [2024-09-20 10:20:30]
  • hack成功,自动添加数据
  • (/hack/848)
  • [2024-03-18 21:48:05]
  • hack成功,自动添加数据
  • (/hack/579)
  • [2024-03-18 21:45:33]
  • hack成功,自动添加数据
  • (/hack/578)
  • [2024-03-09 09:03:37]
  • 评测
  • 测评结果:WA
  • 用时:153ms
  • 内存:4108kb
  • [2024-03-09 09:03:36]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1e5+5,M=N*50+5,K=1000+5,mod=1e9+9,Mod=mod-1;const db eps=1e-9;const ll INF=2e18+7;mt19937 rnd(263082);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#ifdef LOCAL
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
	#else 
	#define gdb(...) void()
	#endif
}using namespace Debug;
int n,k,m;char s[N];
const ll m1=(ll)1e17+3,m2=(ll)1e17+31;
ll f1[N],f2[N];
void Solve(){
	int i,j,h;scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++){
		scanf("%s",s+1);m=strlen(s+1);
		for(j=1;j<=m;j++) s[j]-='0';for(j=m+1;j<=k;j++) s[j]=0;
		for(j=m;j>k;j--)while(s[j]){
			s[j-k]+=s[j];s[j]=0;
			int x=j-k;while(s[x]>=10) s[x+1]+=s[x]/10,s[x]%=10,x++;
		}
		for(j=k;j;j--){
			f1[i]=(f1[i]*10+s[j])%m1;
			f2[i]=(f2[i]*10+s[j])%m2;
			// gdb((int)s[j]);
		}
		// gdb(f1[j],f2[j]);
	}
	ll p1=1,p2=1;for(i=1;i<=k;i++) p1=p1*10%m1,p2=p2*10%m2;p1--;p2--;
	int ans=0;
	for(i=1;i<=n;i++)for(j=i;j<=n;j++)for(h=j;h<=n;h++){
		int o1=-1,o2=-1;
		ll w=(f1[i]+f1[j]+f1[h])%m1;
		if(w==0) o1=0;
		else if(w==p1) o1=1;
		else if(w==p1*2%m1) o1=2;
		else if(w==p1*3%m1) o1=3;
		w=(f2[i]+f2[j]+f2[h])%m2;
		if(w==0) o2=0;
		else if(w==p2) o2=1;
		else if(w==p2*2%m2) o2=2;
		else if(w==p2*3%m2) o2=3;
		if(~o1&&~o2&&o1==o2) ans++/*,gdb(i,j,h,o1,o2)*/;
	}
	printf("%d\n",ans);
}
int main(){
	int t=1;
	// scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

詳細信息

Test #1:

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

input:

4 1
0
1
10
17

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 55ms
memory: 4028kb

input:

500 859
7118711592236878297922359501613604144948355616986970837340677671376753603836852811886591300370143151943368529129749813118476151865844255212534355441611481420938483178075143062691345257288242460282715389758789648541099090735875617822348551942134616963557723055980260082230902505269975518146286...

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 118ms
memory: 4092kb

input:

500 17336
11871159223687829792235950161360414494835561698697083734067767137675360383685281188659130037014315194336852912974981311847615186584425521253435544161148142093848317807514306269134525728824246028271538975878964854109909073587561782234855194213461696355772305598026008223090250526997551814628...

output:

0

result:

ok 1 number(s): "0"

Test #4:

score: 0
Accepted
time: 153ms
memory: 4108kb

input:

500 1
751324443898124078584847834484321089092662321556147445230263526014359393841194947303407593948729802551881289193716611867931891257925091769456350249725997883453296895094445731130479434019358742162771547784250401546380268386074363779242500860317042151185119666027858022664683818314351285215150806...

output:

2327631

result:

ok 1 number(s): "2327631"

Test #5:

score: -100
Wrong Answer
time: 136ms
memory: 4076kb

input:

500 2
408542968136435277974575411503179002415404345446801430469044749372949272333801248935236224652806667129749035002588943020176263162139056819871274824302889304493205266143688886696157147111754418731401856424401766968832165255416237731963027205324149660112574729610391396555581935236134531799950318...

output:

211806

result:

wrong answer 1st numbers differ - expected: '212002', found: '211806'