#1189376

Solution for 2000: Misterious Gems by capythm

Source Code Status Test Cases
    Policy: public     Reviewed: 194    
00.00 sec    1152 KB    47 lines     859 bytes    2015-01-17 14:30
#include <iostream>
using namespace std;
int main( void )
{
  while( 1 ){
    int N,M,x,y,r,dx,dy;
    char dir;
    int d[21][21];
    for( x=0; x<=20; x++ ){
      for( y=0; y<=20; y++ ){
        d[x][y] = 0;
      }
    }

    cin >> N;
    if( N == 0 ) break;
    for( int i=0; i<N; i++ ){
      cin >> x >> y;
      d[x][y] = 1;
    }

    cin >> M;
    x = y = 10;
    int n = d[x][y];
    d[x][y] = 0;
    for( int i=0; i<M; i++ ){
      cin >> dir >> r;
      switch( dir ){
        case 'N' : dx=0; dy=1; break;
        case 'E' : dx=1; dy=0; break;
        case 'S' : dx=0; dy=-1; break;
        case 'W' : dx=-1; dy=0; break;
      }
      for( int j=0; j<r; j++ ){
        x += dx; y += dy;
        n += d[x][y];
        d[x][y] = 0;
      }
    }
    if( N == n ){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

Compile Error Logs:
You are not authorized to see the message.

Status
Judge: 1/1 C++ CPU: 00.00 sec Memory: 1152 KB Length: 859 B 2015-01-17 14:30 2015-01-17 14:30
Results for testcases
Case # Verdict CPU Time Memory In Out Case Name
Case #1: : Accepted 00.00 sec 1152 KB
< prev | / | next >  
 
Judge Input #  ( | ) Judge Output #  ( | )


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags