QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#314893#7857. (-1,1)-Sumpleteone_god_and_two_dogs#Compile Error//C++14973b2024-01-26 14:17:572024-01-26 14:17:58

Judging History

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

  • [2024-01-26 14:17:58]
  • 评测
  • [2024-01-26 14:17:57]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
using ll=long long;
int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n;
	cin>>n;
	vector A(n,vector<int>(n));
	vector ans(n,vector<int>(n));
	vector<int> r(n),c(n);
	for(int i=0;i<n;++i){
		string s;
		cin>>s;
		for(int j=0;j<n;++j){
			if(s[j]=='+')A[i][j]=1;
			else A[i][j]=-1;
		}
	}
	for(int i=0;i<n;++i)cin>>r[i];
	for(int i=0;i<n;++i)cin>>c[i];
	for(int i=0;i<n;++i)
		for(int j=0;j<n;++j)
			if(A[i][j]==-1)
				r[i]++,c[j]++;
	for(int j=0;j<n;++j){
		priority_queue<pair<int,int>>que;
		for(int i=0;i<n;++i)
			que.emplace(r[i],i);
		while(c[j]&&!que.empty()){
			auto [_,i]=que.top();
			que.pop();
			if(c[j]&&r[i])
				c[j]--,r[i]--,ans[i][j]=1;
		}
		
		//if(c[j])cout<<j<<endl;
		if(c[j]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;	
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			if(A[i][j]==1)cout<<ans[i][j];
			else cout<<1-ans[i][j];
		}
		cout<<endl;
	}
	return 0;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:10:16: error: missing template arguments before ‘A’
   10 |         vector A(n,vector<int>(n));
      |                ^
answer.code:11:16: error: missing template arguments before ‘ans’
   11 |         vector ans(n,vector<int>(n));
      |                ^~~
answer.code:17:38: error: ‘A’ was not declared in this scope
   17 |                         if(s[j]=='+')A[i][j]=1;
      |                                      ^
answer.code:18:30: error: ‘A’ was not declared in this scope
   18 |                         else A[i][j]=-1;
      |                              ^
answer.code:25:28: error: ‘A’ was not declared in this scope
   25 |                         if(A[i][j]==-1)
      |                            ^
answer.code:32:30: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   32 |                         auto [_,i]=que.top();
      |                              ^
answer.code:35:47: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   35 |                                 c[j]--,r[i]--,ans[i][j]=1;
      |                                               ^~~
      |                                               abs
answer.code:47:28: error: ‘A’ was not declared in this scope
   47 |                         if(A[i][j]==1)cout<<ans[i][j];
      |                            ^
answer.code:47:45: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   47 |                         if(A[i][j]==1)cout<<ans[i][j];
      |                                             ^~~
      |                                             abs
answer.code:48:38: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   48 |                         else cout<<1-ans[i][j];
      |                                      ^~~
      |                                      abs