Submission #28142

# Submission time Handle Problem Language Result Execution time Memory
28142 2017-07-15T13:08:39 Z asd(#1217, kjp4155) The City and The Bitcoin (FXCUP2_city) C++14
0 / 1
0 ms 2800 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <deque>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll,ll> Pll;

#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define repp(i, n) for(int i=1;i<=n;i++)
#define all(x) x.begin(), x.end()

#define geti1(X) scanf("%d",&X)
#define geti2(X,Y) scanf("%d%d",&X,&Y)
#define geti3(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define geti4(X,Y,Z,W) scanf("%d%d%d%d",&X,&Y,&Z,&W)

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define geti(...) GET_MACRO(__VA_ARGS__, geti4, geti3, geti2, geti1) (__VA_ARGS__)

#define INF 987654321
#define IINF 987654321987654321
#define MAXV 3000500


#define MOD 1234567

int N,M,T,K;
int p[400][400];
bool vis[400][400];
bool inbound(int y, int x){
	if( x < 1 || y < 1 || x > M || y > N ) return false;
	return true;
}
int xx[2] = {1,0}, yy[2] = {0,1};
int main(){
	geti(M,N);
	repp(i,N){
		repp(j,M) geti(p[i][j]);
	}

	queue<Pi> q; q.push({1,1});
	vis[1][1] = true;
	while(!q.empty()){
		int x = q.front().Se, y = q.front().Fi;
		q.pop();
		rep(k,2){
			int nx = x + xx[k]; int ny = y + yy[k];
			if( !inbound(ny,nx) ) continue;
			if( vis[ny][nx] ) continue;
			q.push({ny,nx}); vis[ny][nx] = true; 
		}
	}

	if( vis[N][M] ) printf("Yes\n");
	else printf("No");
}

Compilation message

city.cpp: In function 'int main()':
city.cpp:55:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  geti(M,N);
           ^
city.cpp:57:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   repp(j,M) geti(p[i][j]);
                          ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2800 KB Output is correct
2 Incorrect 0 ms 2800 KB Output isn't correct
3 Halted 0 ms 0 KB -