Submission #309478

# Submission time Handle Problem Language Result Execution time Memory
309478 2020-10-03T14:40:34 Z AngelKnows Vision Program (IOI19_vision) C++14
0 / 100
1 ms 512 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for (int i=1;i<=n;i++)
#define REP(i,a,b) for (int i=a;i<=b;i++)
 
#define pb push_back
#define fi first
#define se second
#define pi pair<int,int>
#define mp make_pair
 
typedef long long ll;

const int inf=0x3f3f3f3f;
const ll linf=1e18;
const int N=200+10;
const double eps=1e-5;
const int mo=1e9+7;

vector<int> v;
int t;
int r1,r2,c1,c2;
void construct_network(int h, int w, int k) {
	FOR(i,h) {
    	v.clear();
		FOR(j,w) v.pb((i-1)*h+j-1);
		t=add_or(v);
		if (t==1) {
			if (r1==0) r1=i;
			else r2=i;
		}
	}
	if (r1!=r2) {
		FOR(j,w) {
			t=add_not((r1-1)*h+j-1);
			if (t==0) {
				c1=j;
				break;
			}
		}
		FOR(j,w) {
			t=add_not((r2-1)*h+j-1);
			if (t==0) {
				c2=j;
				break;
			}
		}
		if (abs(r1-r2)+abs(c1-c2)==k) {
			FOR(i,h) FOR(j,w) {
				if (i==r1&&j==c1||i==r2&&j==c2) continue;
				add_not((i-1)*h+j-1);
				return;
			}
		} else {
			add_not((r1-1)*h+c1-1);
			return;
		}
	} else {
		FOR(j,w) {
			t=add_not((r1-1)*h+j-1);
			if (t==0) {
				if (c1==0) c1=j;
				else c2=j;
			}
		}
		if (abs(c1-c2)==k) {
			FOR(i,h) FOR(j,w) {
				if (i==r1&&j==c1||i==r2&&j==c2) continue;
				add_not((i-1)*h+j-1);
				return;
			}
		} else {
			add_not((r1-1)*h+c1-1);
			return;
		}
	}
    return;
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:51:14: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   51 |     if (i==r1&&j==c1||i==r2&&j==c2) continue;
      |         ~~~~~^~~~~~~
vision.cpp:69:14: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   69 |     if (i==r1&&j==c1||i==r2&&j==c2) continue;
      |         ~~~~~^~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 512 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -