392021-01-08 20:26:20mraron2015. szeptembercpp11Wrong answer on test 29680ms9728 KiB
#include<bits/stdc++.h>
#include<cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;

#define all(s) (s).begin(),(s).end()
#define pb push_back
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define INF std::numeric_limits<int>::max()
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

int d1[4][2]={{1,0},{0,1},{0,-1},{-1,0}};
int d2[8][2]={{1,0},{0,1},{0,-1},{-1,0},{1,1},{-1,1},{1,-1},{-1,-1}};


int main()
{
	IO;
	int n,m;cin>>n>>m;
	int k;cin>>k;
	vector<pair<pair<int,int>,int>> pp;
	for(int i=0;i<k;++i)
	{
		int a,b,c;cin>>a>>b>>c;pp.pb(mp(mp(a,b),c));
	}
		
	auto valid=[pp,n,m](int x, int y) -> bool {
		bool add=true;
		if(x>=0 && y>=0 && x<n && y<m)
		{
			for(auto ii:pp)
			{
				if(!add) break;
				if((x-ii.first.first)*(x-ii.first.first)+(y-ii.first.second)*(y-ii.first.second)<=(ii.second)*(ii.second)) add=false;
			}
		}else {
			add = false;
		}
		return add;
	};
	
	int t[n][m];
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<m;++j) 
		{
			t[i][j]=0;
		}
	}
	
	queue<pair<int,int>> q;
	for(int i=0;i<m;++i) {if(valid(0,i)){q.push(mp(0,i));}}
	
	bool found= false;
	while(!q.empty() && !found)
	{
		auto tt = q.front();
		q.pop();
		int i=tt.first,j=tt.second;
		
		if(t[i][j]) continue;
		t[i][j]=1;
		//if(i==n-1) {found=true;break;}
		for(int kk=0;kk<4;++kk)
		{
			int x=i+d1[kk][0], y=j+d1[kk][1];
			if(valid(x,y)&&!t[x][y]) {q.push(mp(x,y));}
		}
	}
	for(int i=0;i<m;++i) {if(t[n-1][i]) {found=true;}}

	#ifdef NICE
		for(int i=0;i<n;++i)
		{
			for(int j=0;j<m;++j) 
			{
				if(!t[i][j])cout<<"\e[31;1m";
				if(t[i][j])cout<<"\e[33;1m";
				cout<<t[i][j]<<" \n"[j==m-1];
				cout<<"\e[0m";
			}
		}
	#endif

	cout<<(found?"Vezet":"Nem vezet")<<"\n";
	return 0;
}
1 - Accepted
Memory: 1760KiB
Time: 2ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

2 - Accepted
Memory: 1828KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

3 - Accepted
Memory: 9724KiB
Time: 228ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

4 - Accepted
Memory: 9728KiB
Time: 680ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

5 - Accepted
Memory: 9628KiB
Time: 12ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

6 - Accepted
Memory: 7720KiB
Time: 4ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

7 - Accepted
Memory: 5004KiB
Time: 3ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

8 - Accepted
Memory: 9268KiB
Time: 4ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

9 - Accepted
Memory: 2204KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

10 - Accepted
Memory: 3636KiB
Time: 2ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

11 - Accepted
Memory: 7392KiB
Time: 20ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

12 - Accepted
Memory: 2092KiB
Time: 2ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

13 - Accepted
Memory: 2860KiB
Time: 2ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

14 - Accepted
Memory: 2904KiB
Time: 2ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

15 - Accepted
Memory: 3484KiB
Time: 2ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

16 - Accepted
Memory: 2456KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

17 - Accepted
Memory: 1920KiB
Time: 4ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

18 - Accepted
Memory: 2468KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

19 - Accepted
Memory: 4400KiB
Time: 2ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

20 - Accepted
Memory: 2720KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

21 - Accepted
Memory: 2904KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

22 - Accepted
Memory: 9596KiB
Time: 4ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

23 - Accepted
Memory: 9600KiB
Time: 4ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

24 - Accepted
Memory: 9600KiB
Time: 4ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

25 - Accepted
Memory: 9600KiB
Time: 4ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

26 - Accepted
Memory: 9596KiB
Time: 4ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

27 - Accepted
Memory: 9600KiB
Time: 4ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

28 - Accepted
Memory: 9600KiB
Time: 4ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

29 - Wrong answer
Memory: 1856KiB
Time: 2ms

Program's output:
Nem vezet
Expected output:
Vezet
Checker output:
wrong answer 1st words differ - expected: 'Vezet', found: 'Nem'