# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
522436 | 2022-02-05T03:34:37 Z | fcmalkcin | 조교 (CEOI16_popeala) | C++17 | 73 ms | 75016 KB |
/*#pragma GCC optimize("Ofast") #pragma GCC optimization("unroll-loops, no-stack-protector") #pragma GCC target("avx,avx2,fma")*/ #include <bits/stdc++.h> using namespace std; #define ll int #define pll pair<ll,ll> #define ff first #define ss second #define pb push_back #define endl "\n" #define For(i,a,b) for (ll i=a;i<=b;i++) mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); const ll maxn=2e4+100; const ll mod=998244353 ; const ll base=2e9+10000; /// you will be the best but now you just are trash /// goal 3/7 vector<ll> adj[maxn][52]; vector<ll> adj1[maxn][52]; ll f[maxn]; char a[53][maxn]; ll nxt[53][maxn]; ll dp[maxn][53]; ll dp1[maxn][53][53]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if (fopen("popeala.inp", "r")) { freopen("popeala.inp", "r", stdin); freopen("popeala.out", "w", stdout); } ll n, t, s; cin>> n>> t>> s; for (int i=1; i<=t; i++) { ll x; cin>> x; f[i]=f[i-1]+x; } for (int i=1; i<=n; i++) { for (int j=1; j<=t; j++) { cin>> a[i][j]; } for (int j=t; j>=1; j--) { if (a[i][j]=='1') nxt[i][j]=nxt[i][j+1]+1; else nxt[i][j]=0; } } for (int p=0; p<=t; p++) { for (int j=0; j<=s; j++) { dp[p][j]=base; for (int h=0; h<=n; h++) { dp1[p][j][h]=base; } } } dp[0][0]=0; for (int i=1; i<=t+1; i++) { vector<ll> vt; for (int h=1; h<=n; h++) { vt.pb(nxt[h][i]); } sort(vt.begin(),vt.end()); /*if (i>=2) { for (int j=0; j<=s; j++) { for (int t=0; t<=n; t++) { dp1[i-1][j][t]=min(dp1[i-1][j][t],dp1[i-2][j][t]); dp[i-1][j]=min(dp[i-1][j],dp1[i-1][j][t]+f[i-1]*t); if (i==3) { cout <<dp1[i-1][j][t]<<" "<<dp[i-1][j]<<" "<<j<<" "<<t<<" chk"<<endl; } } } }*/ for (int j=0; j<=s; j++) { dp1[i+vt.back()][j+1][0]=min(dp1[i+vt.back()][j+1][0],dp[i-1][j]-0*f[i-1]); ll sl=0; for (int t=vt.size()-1;t>=0;t--) { sl++; ll pre=0; if (t) { pre=vt[t-1]; } dp1[i+pre][j+1][sl]=min(dp1[i+pre][j+1][sl],dp[i-1][j]-sl*f[i-1]); } } } for(int h=1;h<=s;h++) { cout <<dp[t][h]<<endl; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 49524 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 36 ms | 55564 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 73 ms | 75016 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 49524 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |