跳到正文

个人记录

8.25

huanzhenyang0420约 9 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 9 分钟

版本

  1. v1当前

今日比赛8.25

T1

U593075

赛时代码&得分
Accepted1̸00tps\color{green}{Accepted\not100tps}
C++
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int a,b,c,d,e,f,x,f1=0,f2=0,ans1=0,ans2=0,now_1_1=0,now_1_2=0,now_2_1=0,now_2_2=0;
	cin>>a>>b>>c>>d>>e>>f>>x;
	for(int i=1;i<=x;i++){
		if(now_1_1!=a&&f1==0){
			now_1_1++;
			ans1+=b;
		}else if(now_1_1==a&&f1==0){
			now_1_1=0;
			f1=1;
		}else if(f1==1&&now_1_2!=c){
			now_1_2++;
		}else if(f1==1&&now_1_2==c){
			now_1_2=0;
			f1=0;
		}
		if(now_2_1!=d&&f2==0){
			now_2_1++;
			ans2+=e;
		}else if(now_2_1==d&&f2==0){
			now_2_1=0;
			f2=1;
		}else if(f2==1&&now_2_2!=f){
			now_2_2++;
		}else if(f2==1&&now_2_2==f){
			now_2_2=0;
			f2=0;
		}
//		cout<<ans1<<" "<<ans2<<endl;
	}
	if(ans1>ans2) cout<<"Takahashi";
	else if(ans1<ans2) cout<<"Aoki";
	else cout<<"Draw";
	return 0;
}
T2

T642548

题意

题意分析:

观察可知无论从哪里开始引爆,答案总是固定的一个炸弹可以引爆的其他炸弹是固定的,有点像连通块所以搜索连通块,每次搜索就相当于访问了一个连通块,搜索的次数就是答案。观察可知无论从哪里开始引爆,答案总是固定的\\一个炸弹可以引爆的其他炸弹是固定的,有点像连通块\\所以搜索连通块,每次搜索就相当于访问了一个连通块,搜索的次数就是答案。
赛时代码&得分
WrongAnswer1̸0tps\color{red}{Wrong Answer\not10tps}
C++
int main(){
	cout<<1;
	return 0;
}
正确代码
C++
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
char a[1005][1005];
int ans=0;
void dfs(int x,int y){
    for(int i=1;i<=m;i++){
        if(a[x][i]=='1'){
            a[x][i]='0';
            dfs(x,i);
        }
    }
    for(int i=1;i<=n;i++){
        if(a[i][y]=='1'){
            a[i][y]='0';
            dfs(i,y);
        }
    }
}
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>a[i][j];
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(a[i][j]=='1'){
                dfs(i,j);
                ans++;
            }
        }
    }
    cout<<ans;
    return 0;
}
T3

T642551

题意

题意分析:

对于每一组,尽量从最小的数开始数,依次把后面的数算进来,如果没有就结束对于每一组,尽量从最小的数开始数,依次把后面的数算进来,如果没有就结束
赛时代码&得分
WrongAnswer0̸tps\color{red}{Wrong Answer\not0tps}
C++
由于此内容过长,已被删除。(详见置顶帖)
正确代码
C++
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,a[200005];
map<int,int> mp;
void solve(){
	mp.clear();
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		mp[x]++;
	}
	int cnt=0;
	while(mp.size()){
		cnt++;
		int x;
		for(auto xx:mp){
			x=xx.first;
			break;
		}
		mp[x]--;
		if(mp[x]==0) mp.erase(x);
		while(1){
			x++;
			if(mp.count(x)==0) break;
			mp[x]--;
			if(mp[x]==0) mp.erase(x);
		}
	}
	cout<<cnt<<endl;
}
int main(){
	int t;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}
T4

T643724

题意

题意分析:

选或不选的搜索:枚举每个位置是否有雷,再检查这种方案是否可行,ans++选或不选的搜索:\\枚举每个位置是否有雷,再检查这种方案是否可行,ans++
小提示
多测试几个样例可知:当第1行第1列0/1确定之后,下面的就确定了。所以答案最多为2答案的范围是:0,1,2多测试几个样例可知:\\当第1行第1列0/1确定之后,下面的就确定了。\\ 所以答案最多为 2\\答案的范围是:0,1,2
赛时代码&得分
WrongAnswer4̸0tps\color{red}{Wrong Answer\not40tps}
C++
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	cout<<1;
	return 0;
}
正确代码
C++
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[10005],f[10001],n,tot;
bool jud(){
	for(int i=1;i<=n;i++){
		f[i+1]=a[i]-f[i]-f[i-1];
		if(f[i+1]<0||f[i+1]>1) return 0;
	}
	if(f[n+1]!=0)return 0;
	return 1;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	if(a[1]==0) tot+=jud();
	else if(a[1]==1){
		f[1]=1;
		tot+=jud();
		memset(f,0,sizeof(f));
		f[2]=1;
		tot+=jud();
	}else{
		f[1]=f[2]=1;
		tot+=jud();
	}
	cout<<tot;
	return 0;
}
T5

U592947

题意

题意分析:

赛时代码&得分
WrongAnswer0̸tps\color{red}{Wrong Answer\not0tps}
C++
此内容已被删除。(详见置顶帖)
暴力代码
C++
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,a[1100000],ans;
void dfs(int u){
	if(u>n){
		ans++;
		return;
	}
	for(int i=a[u-1]-1;i<=a[u-1]+1;i++){
		if(i==0||i==10)continue;
		a[u]=i;
		dfs(u+1);
	}
}
int main(){
	cin>>n;
	for(int i=1;i<=9;i++){
		a[1]=i;
		dfs(2);
	}
	cout<<ans;
	return 0;
}
原文