Submission #00046
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() #define fi first #define se second typedef vector< int >vint; typedef pair< int , int >pint; typedef vector<pint>vpint; template < typename A, typename B> inline void chmin(A &a,B b){ if (a>b)a=b;} template < typename A, typename B> inline void chmax(A &a,B b){ if (a<b)a=b;} string latte= "RGB" ; int D[10]; char S[10]; int cnt[3][10]; int calc( int d[]){ int res=0; rep(i,10){ res+=d[i]/3; d[i]%=3; } rep(i,10-2){ int mi=min(d[i],min(d[i+1],d[i+2])); res+=mi; d[i]-=mi;d[i+1]-=mi;d[i+2]-=mi; } return res; } void solve(){ memset (cnt,0, sizeof (cnt)); rep(i,9)cin>>D[i]; rep(i,9)cin>>S[i]; rep(i,9){ int tmp=find(all(latte),S[i])-latte.begin(); cnt[tmp][D[i]]++; } bool ok= true ; int sum=0; rep(i,3)sum+=calc(cnt[i]); if (sum==3)cout<<1<<endl; else cout<<0<<endl; } signed main(){ int T;cin>>T; while (T--)solve(); return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0009 - ラミー |
ユーザー名 | latte0119 |
投稿日時 | 2017-03-30 20:23:02 |
言語 | C++11 |
状態 | Accepted |
得点 | 20 |
ソースコード長 | 1178 Byte |
最大実行時間 | 16 ms |
最大メモリ使用量 | 480 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 20 / 20 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
rummy.in | AC | 16 ms | 480 KB |
1
|