QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#756616#7857. (-1,1)-SumpleteasaltfishCompile Error//C++231.6kb2024-11-16 21:12:332024-11-16 21:12:34

Judging History

你现在查看的是最新测评结果

  • [2024-11-16 21:12:34]
  • 评测
  • [2024-11-16 21:12:33]
  • 提交

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;
}

详细

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