QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#747922#7615. Sequence FoldinginksamuraiWA 0ms3552kbC++231.2kb2024-11-14 18:45:202024-11-14 18:45:27

Judging History

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

  • [2024-11-14 18:45:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3552kb
  • [2024-11-14 18:45:20]
  • 提交

answer

#include <bits/stdc++.h>
#define int ll
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define rng(i,c,n) for(int i=c;i<n;i++)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define vec(...) vector<__VA_ARGS__>
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}

void slv(){
	int n,m;
	cin>>n>>m;

	map<int,int> mp;
	rep(i,m){
		int x;
		cin>>x;
		mp[x]=1;
	}
	int ans=0;
	while(n){
		map<int,int> ne_map;
		for(auto [x,c]:mp){
			int y=n-x+1;
			int rc=mp.find(y)==mp.end()?0:mp[y];
			if(c==rc){
				ne_map[min(x,y)]=c;
			}else{
				int nec;
				if(c!=-1 and rc!=-1){
					ans+=1,nec=-1;
				}else if(c!=-1 or rc!=-1){
					ans+=1;
					nec=-1;
				}else{
					nec=-1;
				}
				ne_map[min(x,y)]=nec;
			}
		}
		mp.swap(ne_map);
		// print(ans);
		// for(auto [x,c]:mp){
		// 	print(x,c);
		// }
		n/=2;
	}		
	print(ans);
}

signed main(){
	ios::sync_with_stdio(0),cin.tie(0);
	int t;
	// cin>>t;
	t=1;
	rep(cs,t){
		slv();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3552kb

input:

8 3
1 5 8

output:

4 

result:

wrong answer 1st lines differ - expected: '2', found: '4 '