QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#506001#6422. Evil CoordinateFoedere0Compile Error//C++23975b2024-08-05 14:33:352024-08-05 14:33:35

Judging History

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

  • [2024-08-05 14:33:35]
  • 评测
  • [2024-08-05 14:33:35]
  • 提交

answer

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
#include<vector>
#include<stack>
#define int long long
#define endl '\n'
using namespace std;
typedef pair<int,int> PII;
const int N=200200;
int n;
int a[N],b[N];
int x,y;
string s;
int o=0,p=0;
map<char,int> m;
void solve(){
	cin>>x>>y>>s;
	if(x==0&&y==0){
		cout<<"Impossible"<<endl;
		return;
	}
	for(int i=0;i<s.size();i++){
		if(s[i]=='L') o--;
		if(s[i]=='R') o++;
		if(s[i]=='U') p++;
		if(s[i]=='D') p--;
		m[s[i]]++;
	}
	if(o==x&&p==y){
		cout<<"Impossible"<<endl;
		return;
	}
	if(abs(o)<abs(x)){
		if(x>=0){
			while(m[L]){
				cout<<"L";
			}
			while(m[R]){
				cout<<"R";
			}
		}
		else{
			while(m[L]){
				cout<<"L";
			}
			while(m[R]){
				cout<<"R";
			}
		}
	}
	
}
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int T=1;
	cin>>T;
	while(T--){
		solve();
	}
	return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:39:33: error: ‘L’ was not declared in this scope
   39 |                         while(m[L]){
      |                                 ^
answer.code:42:33: error: ‘R’ was not declared in this scope
   42 |                         while(m[R]){
      |                                 ^
answer.code:47:33: error: ‘L’ was not declared in this scope
   47 |                         while(m[L]){
      |                                 ^
answer.code:50:33: error: ‘R’ was not declared in this scope
   50 |                         while(m[R]){
      |                                 ^