QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#499475 | #6723. Grid with Arrows | Ink_bai | Compile Error | / | / | C++20 | 2.0kb | 2024-07-31 14:43:56 | 2024-07-31 14:43:56 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
updiv(int a, int b)
{
return a / b + (a % b ? 1 : 0);
}
int main()
{
int T;
cin >> T;
while (T--)
{
char s[100005];
int a[100005] = {0};
int b[100005] = {0};
int n, m;
cin >> n >> m;
for (int i = 1; i <= n * m; i++)
{
char c;
cin >> c;
s[i] = c;
}
for(int i = 1; i <= n * m; i++)
{
int x;
cin >> x;
if(s[i] == 'u'&& i - m * x >= 1)
{
a[i - m * x]++;
b[i]++;
}
else if(s[i] == 'd'&& i + m * x <= n * m)
{
a[i + m * x]++;
b[i]++;
}
else if(s[i] == 'l'&& updiv(i, m) == updiv(i - x, m))
{
a[i - x]++;
b[i]++;
}
else if(s[i] == 'r'&& updiv(i, m) == updiv(i + x, m))
{
a[i + x]++;
b[i]++;
}
}
int u = 0, v = 0;
bool flag = false;
for(int i = 1; i <= n * m; i++)
{
if(flag||u > 1||v > 1)
{
flag = true;
break;
}
else if(a[i] == b[i]&& b[i] == 0)
{
flag = true;
break;
}
else if(a[i] - b[i] == 1)
{
u++;
}
else if(b[i] - a[i] == 1)
{
v++;
}
else if(a[i] == b[i])
{
continue;
}
else
{
flag = true;
}
}
if(u > 1||v > 1)
{
flag = true;
}
if(flag)
{
cout << "No" << endl;
}
else
{
cout << "Yes" << endl;
}
}
}
Details
answer.code:5:1: error: ISO C++ forbids declaration of ‘updiv’ with no type [-fpermissive] 5 | updiv(int a, int b) | ^~~~~