Submission #60041

#TimeUsernameProblemLanguageResultExecution timeMemory
60041nvmdavaMecho (IOI09_mecho)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define mp make_pair #define ff first #define ss second using namespace std; int n,s; int t[802][802]; char c[802][802]; int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; bool pos(int x,int y, int now){ for(int i = 0; i < 4; i++){ if(c[x + dx[i]][y + dy[i]]=='D'){ return 1; } if(c[x + dx[i]][y + dy[i]]=='G'&&t[x + dx[i]][y + dy[i]] > now + 1){ c[x + dx[i]][y + dy[i]='T'; if(pos(x + dx[i],y + dy[i],now+1)){ c[x + dx[i]][y + dy[i]]='G'; return 1; }; c[x + dx[i]][y + dy[i]]='G'; } } return 0; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int i,j,xx,yy; cin>>n>>s; queue<pair<int, int > > q; for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ cin>>c[i][j]; if(c[i][j]=='H'){ q.push(mp(i,j)); } else if(c[i][j]=='M'){ xx=i; yy=j; } } } int x,y; while(!q.empty()){ x=q.front().ff; y=q.front().ss; q.pop(); for(i=0;i<4;i++){ if(c[x + dx[i]][y + dy[i]]=='G'&&t[x + dx[i]][y + dy[i]]==0){ t[x + dx[i]][y + dy[i]] = t[x][y]+s; q.push(mp(x + dx[i] , y + dy[i])); } } } int l = -1 , r = 1e9,m; while(l + 1 != r){ m = (l + r) / 2; if(pos(xx,yy,m)){ l = m; } else { r = m; } } cout<<l/s; }

Compilation message (stderr)

mecho.cpp: In function 'bool pos(int, int, int)':
mecho.cpp:18:27: error: lvalue required as left operand of assignment
    c[x + dx[i]][y + dy[i]='T';
                           ^~~
mecho.cpp:18:30: error: expected ']' before ';' token
    c[x + dx[i]][y + dy[i]='T';
                              ^