# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
800848 |
2023-08-02T00:36:39 Z |
HD1 |
Robots (APIO13_robots) |
C++14 |
|
1 ms |
212 KB |
// we all are lost trying to be someone.
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_studio(0); cin.tie(0);
#define sz(x) long long(x.size())
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define ss second
#define ff first
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
const int MAX=1e6;
const int inf=1e9;
const int mod=1e9+7;
char A[300][300];
void solve(){
ll n, w, h;
ii a, b;
ll cont=0;
cin>>n>>w>>h;
for(ll i=0; i<w; i++){
for(ll j=0; j<h; j++){
cin>>A[i][j];
if(A[i][j]!='.' && A[i][j]!='A' && A[i][j]!='C' && A[i][j]!='x' && cont==ll(0)){
a.ff=i;
a.ss=j;
cont++;
}
else if(A[i][j]!='.' && A[i][j]!='A' && A[i][j]!='C' && A[i][j]!='x' && cont==ll(1)){
b.ff=i;
b.ss=j;
cont++;
}
}
}
if(a.ff!=b.ff and a.ss!=b.ss){
cout<<-1<<endl;
return;
}
if(a.ff==b.ff){
bool xd=true;
for(int i=min(a.ss,b.ss); i<=max(a.ss,b.ss); i++){
if(A[a.ff][i]=='x')xd=false;
}
if(xd)cout<<1<<endl;
else cout<<-1<<endl;
return;
}
bool xd=true;
for(int i=min(a.ff,b.ff); i<=max(a.ff,b.ff); i++){
if(A[i][a.ss]=='x')xd=false;
}
if(xd)cout<<1<<endl;
else cout<<-1<<endl;
return;
}
int main(){
solve();
return 0;
}
/*
2 5 5
.2...
...xx
....x
x.xx.
x1x..*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |