Submission #1205527


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>P;

int p[40][40];
P ba[500];
P ca[500];
string res[500];

int main(){
	int h,w,k,t;
	cin>>h>>w>>k>>t;
	
	for(int i=0;i<k;i++){
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		ba[i]=P(a,b);
		ca[i]=P(c,d);
		p[a][b]=1;
		p[c][d]=1;
		}
		
		for(int i=0;i<k;i++){
			if(ba.first[i]<ca[i].first){
				if(!p[ba[i].first+1][ba[i].second]){swap(p[ba[i].first][ba[i].second],p[ba[i].first+1][ba[i].second]);
			res[i].push_back('R');
			}
			else res[i].push_back('-');
				}
			else{
				if(!p[ba[i].first-1][ba[i].second]){
					swap(p[ba[i].first][ba[i].second],p[ba[i].first-1][ba[i].second]);
					res[i].push_back('L');
					}
					else res[i].push_back('-');
				}	
			}
			
		cout<<1<<endl;
		for(int i=0;i<k;i++)cout<<res[0];
		cout<<endl;	
		
	return 0;
	}

Submission Info

Submission Time
Task B - 日本橋大渋滞
User Rho17
Language C++14 (GCC 5.4.1)
Score 0
Code Size 859 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:24:10: error: request for member ‘first’ in ‘ba’, which is of non-class type ‘P [500] {aka std::pair<int, int> [500]}’
    if(ba.first[i]<ca[i].first){
          ^