QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#756618 | #7857. (-1,1)-Sumplete | asaltfish | Compile Error | / | / | C++20 | 1.6kb | 2024-11-16 21:12:54 | 2024-11-16 21:12:54 |
Judging History
This is the latest submission verdict.
- [2024-11-16 21:12:54]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-16 21:12:54]
- Submitted
answer
#include <iostream>
#include <string.h>
#include<queue>
using namespace std;
#define ll long long
#define endl '\n'
int mp[4005][4005], n, row[4005], ans[4005][4005], now[4005], now_cl[4005], cl[4005], ac_row[4005], ac_cl[4005];
int cp[4005];
bool cmp(int x, int y)
{
return cl[x] - now_cl[x] > cl[y] - now_cl[y];
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
cin >> n;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
char p;
cin >> p;
if (p == '+')
mp[i][j] = 1;
else
mp[i][j] = -1, ans[i][j] = 1, now[i]--, now_cl[j]--;
}
}
for (int i = 1; i <= n; i++)
{
cin >> row[i];
cp[i] = i;
}
for (int i = 1; i <= n; i++)
{
cin >> cl[i];
}
for (int i = 1; i <= n; i++)
{
sort(cp + 1, cp + n + 1, cmp);
for (int j = 1; j <= min(n, row[i] - now[i]); j++)
{
ans[i][cp[j]] = 1 - ans[i][cp[j]];
now_cl[cp[j]]++;
}
}
for(int i=1;i<=n;i++)
for (int j = 1; j <= n; j++)
{
if (ans[i][j])
ac_row[i] += mp[i][j], ac_cl[j] += mp[i][j];
}
for (int i = 1; i <= n; i++)
{
if (ac_row[i] != row[i] || ac_cl[i] != cl[i])
{
cout << "N0";
return 0;
}
}
cout << "Yes" << endl;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
cout << ans[i][j];
cout << endl;
}
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:42:9: error: ‘sort’ was not declared in this scope; did you mean ‘short’? 42 | sort(cp + 1, cp + n + 1, cmp); | ^~~~ | short