Submission #800848

#TimeUsernameProblemLanguageResultExecution timeMemory
800848HD1Robots (APIO13_robots)C++14
0 / 100
1 ms212 KiB
// 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...