QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#149031 | #5414. Stop, Yesterday Please No More | snowy2002 | WA | 0ms | 3520kb | C++20 | 1.1kb | 2023-08-23 22:11:36 | 2023-08-23 22:11:37 |
Judging History
answer
#include<bits/stdc++.h>
#include<bits/extc++.h>
#define time chrono::system_clock::now().time_since_epoch().count()
#define maxn 1000005
// #define int long long
using namespace std;
using namespace __gnu_pbds;
mt19937_64 rnd(time);
int read() {int x;cin>>x;return x;}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
return 0;
string a;
cin>>a;
int n = a.length();
a = "s" + a;
int cnt1 = count(a.begin(), a.end(), '1');
// cout<<"cnt1:"<<cnt1<<"\n";
int inf = 1e9;
vector f(n + 1, vector(2 * n * n + 1, inf));
int bias = n * n;
f[0][bias] = 0;
for(int i = 0; i < n; i++) {
vector g(n + 1, vector(2 * n * n, inf));
for(int j = 0; j <= n; j++) {
for(int k = 1; k <= 2 * n * n; k++) {
if(f[j][k] != inf) {
g[j][k - j] = min(g[j][k - j], f[j][k] + (a[i + 1] != '0'));
g[j + 1][k + i - j] = min(g[j + 1][k + i - j], f[j][k] + (a[i + 1] != '1'));
}
}
}
f = g;
}
cout<<f[cnt1][bias] / 2;
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3520kb
input:
3 4 5 3 ULDDRR 4 5 0 UUUUUUU 4 5 10 UUUUUUU
output:
result:
wrong answer Answer contains longer sequence [length = 3], but output contains 0 elements