# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
994850 | 2024-06-08T07:33:24 Z | guagua0407 | Bowling (BOI15_bow) | C++17 | 0 ms | 348 KB |
//#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define f first #define s second #define all(x) x.begin(),x.end() #define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int dx[4]={0,0,1,-1}; int dy[4]={1,-1,0,0}; void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } void solve(){ int n; cin>>n; vector<string> str(n); for(int i=0;i<n;i++){ char a,b,c; cin>>a>>b; if(i==n-1) cin>>c; string A(1,a); string B(1,b); string C(1,c); str[i]=A+B; //if(i==n-1) str[i]+=C; } vector<int> val(n); for(int i=0;i<n;i++){ cin>>val[i]; } vector<string> cand; for(int i=0;i<10;i++){ for(int j=0;j+i<10;j++){ string tmp={(char)(i-'0'),(char)(j-'0')}; cand.push_back(tmp); } //string tmp={(char)(i-'0'),'/'}; //cand.push_back(tmp); } //cand.push_back("x-"); return ; vector<ll> dp(305); dp[0]=1; for(int i=0;i<n;i++){ vector<ll> ndp(305); for(auto cur:cand){ bool tf=true; for(int j=0;j<2;j++){ if(str[i][j]!='?' and str[i][j]!=cur[j]){ tf=false; } } if(!tf) continue; int st,en; if(cur[0]=='x') st=10; else st=(int)(cur[0]-'0'); if(cur[1]=='-') en=-1; else if(cur[1]=='/') en=10-st; else en=(int)(cur[1]-'0'); for(int j=0;j+en+st<305;j++){ ndp[j+st+en]+=dp[j]; } } dp=ndp; if(val[i]!=-1){ for(int j=0;j<305;j++){ if(j!=val[i]){ dp[j]=0; } } } } ll ans=0; for(int i=0;i<305;i++){ ans+=dp[i]; } cout<<ans<<'\n'; } int main() {_ int t; cin>>t; while(t--){ solve(); } return 0; } //maybe its multiset not set //yeeorz //laborz
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |