QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#130039 | #6376. LaLa and Lamp | Alinxester | WA | 1ms | 3856kb | C++14 | 2.1kb | 2023-07-23 14:41:35 | 2023-07-23 14:41:38 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define ll long long
#define mod 998244353
#define int128 __int128
#define base 23333
#define base2 19260817
#define db double
#define ldb long double
#define eps 1e-8
#define cmpeps 1e-18
#define lowbit(x) (x & -x)
#define un unsigned
#define rep(i,x,y) for (int i = (x); i <= (y); ++i)
#define drep(i,x,y) for (int i = (x); i >= (y); --i)
#define go(i,u) for (int i = head[u]; i; i = edge[i].next)
#define go_(i,u) for (int i = head[u]; ~i; i = edge[i].next)
#define pii pair<int, int>
#define MP make_pair
#define fir first
#define sec second
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
using namespace std;
//char buf[1<<21],*p1=buf,*p2=buf;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T> inline T rnd(T l,T r) {return uniform_int_distribution<T>(l , r)(rng);}
template<typename T> inline void read (T &t) {
t = 0; char f = 0, ch = getchar(); ldb d = 0.1;
while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
while (ch <= '9' && ch >= '0') t = t * 10 + ch - 48, ch = getchar();
if (ch == '.') {
ch = getchar();
while (ch <= '9' && ch >= '0') t += d * (ch ^ 48), d *= 0.1, ch = getchar();
}
t = (f ? -t : t);
}
template <typename T, typename... Args>
inline void read (T& t, Args&... args) { read(t); read(args...); }
inline void write (int x) {
if (x >= 10) write(x / 10);
cout << (ll) (x % 10);
}
const int N = 2e3 + 2;
int n, a[N][N];
int ans = 1;
inline bool check (int x, int y) {
if (x < 2 || y < 2 || x + 1 > n || y + 1 > n || x == y) return 0;
return 1;
}
inline void solve (int x, int y) {
if (a[x - 1][y - 1] ^ a[x - 1][y] ^ a[x][y - 1] ^ a[x + 1][y] ^ a[x][y + 1] ^ a[x + 1][y + 1])
printf("%lld %lld\n", x, y);
ans &= !(a[x - 1][y - 1] ^ a[x - 1][y] ^ a[x][y - 1] ^ a[x + 1][y] ^ a[x][y + 1] ^ a[x + 1][y + 1]); }
signed main() {
read(n);
rep (i, 1, n) rep (j, 1, i) scanf("%1lld", &a[i][j]);
rep (i, 1, n) rep (j, 1, i) if (check(i, j)) solve(i, j);
if (ans) printf("Yes\n");
else printf("No\n");
return 0;
}
/*
6
0
00
000
0110
00100
000000
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3856kb
input:
6 0 00 000 0110 00100 000000
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
2 0 11
output:
Yes
result:
ok answer is YES
Test #3:
score: 0
Accepted
time: 1ms
memory: 3544kb
input:
3 1 10 011
output:
Yes
result:
ok answer is YES
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3824kb
input:
4 1 11 101 0101
output:
3 2 No
result:
wrong output format YES or NO expected, but 3 found