QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#199639#7346. Frogsnameless_story#Compile Error//C++20712b2023-10-04 13:28:152023-10-04 13:28:15

Judging History

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

  • [2023-10-04 13:28:15]
  • 评测
  • [2023-10-04 13:28:15]
  • 提交

answer

#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	vector<int> a(n+1);
	for (int i=1; i<n; ++i) cin>>a[i];
	stack<int> s;
	vector<int> p(n+1);
	iota(all(p),0);
	for (int i=1; i<=n; ++i)
	{
		if (a[i]-a[i-1]==-2)
		{
			if (s.empty())
			{
				cout<<"No\n";
				return 0;
			}
			int x=s.top(); s.pop();
			swap(p[x],p[i]);
			continue;
		}
		if (a[i]-a[i-1]==0)
		{
			continue;
		}
		if (a[i]-a[i-1]==2)
		{
			s.push(i);
			continue;
		}
		cout<<"No\n";
		return 0;
	}
	cout<<"Yes\n";
	for (int i=1; i<=n; ++i) cout<<p[i]<<" \n"[i==n];
}
dfadsfasdf

Details

answer.code:42:1: error: ‘dfadsfasdf’ does not name a type
   42 | dfadsfasdf
      | ^~~~~~~~~~