QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96730 | #2989. 一双木棋 | Alex10086 | Compile Error | / | / | C++14 | 1.3kb | 2023-04-15 10:06:17 | 2023-04-15 10:06:20 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-04-15 10:06:20]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-04-15 10:06:17]
- 提交
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[11][11],n,m,b[11][11],tot;
struct edge
{
int x,y;
}e[400005];
unordered_map <string,int> k;
vector<int> d[400005];
void init(string s)
{
int res0=0,res1=0,rt=k[s];
for (int i=1;i<=s.size();i++)
{
if (s[i]=='1')
{
res1++;
if (s[i-1]=='0')
{
swap(s[i],s[i-1]);
if (!k[s])
{
k[s]=++tot;
e[tot].x=n-(res0-1),e[tot].y=res1;
// cout<<s<<" "<<tot<<" "<<e[tot].x<<" "<<e[tot].y<<endl;
}
d[rt].emplace_back(k[s]);
init(s);
swap(s[i],s[i-1]);
}
}
else res0++;
}
}
string s;
int res[400005][2],vis[400005][2];
int dfs(int u,int pl)
{
if (vis[u][pl]) return res[u][pl];
vis[u][pl]=1;
int re=-1e9;
if (!d[u].size()) re=0;
for (auto v : d[u]) re=max(re,-dfs(v,pl^1));
if (u==1) return re;
int x=0;
if ((pl^1)) x=a[e[u].x][e[u].y];
else x=b[e[u].x][e[u].y];
return res[u][pl]=re-=x;
}
int main()
{
scanf("%lld%lld",&n,&m);
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++) scanf("%lld",&a[i][j]);
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++) scanf("%lld",&b[i][j]);
s+='X';
for (int i=1;i<=n;i++) s+='0';
for (int i=1;i<=m;i++) s+='1';
k[s]=++tot;
init(s);
cout<<-dfs(1,0);
return 0;
}
Details
cc1plus: error: ‘::main’ must return ‘int’ answer.code: In function ‘int main()’: answer.code:53:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 53 | scanf("%lld%lld",&n,&m); | ~~~~~^~~~~~~~~~~~~~~~~~ answer.code:55:45: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 55 | for (int j=1;j<=m;j++) scanf("%lld",&a[i][j]); | ~~~~~^~~~~~~~~~~~~~~~~ answer.code:57:45: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 57 | for (int j=1;j<=m;j++) scanf("%lld",&b[i][j]); | ~~~~~^~~~~~~~~~~~~~~~~