結果

問題 No.5014 セクスタプル (reactive)
ユーザー FplusFplusF
提出日時 2022-12-29 20:46:48
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 1,877 bytes
コンパイル時間 1,750 ms
実行使用メモリ 22,612 KB
スコア 363,105,118
平均クエリ数 35.00
最終ジャッジ日時 2022-12-29 20:46:59
合計ジャッジ時間 8,270 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
const ll INF=(1ll<<60);
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
int main(){
    vector<vector<vector<int>>> dp(6,vector<vector<int>>(6,vector<int>(6,0)));
    int t=35;
    vector<int> cell(6,0);
    while(t--){
        vector<int> cnt(6,0);
        rep(i,6){
            int d;
            cin >> d;
            d--;
            cnt[d]++;
        }
        int max_score=0,pi=0,pj=0;
        rep(i,6){
            rep(j,6){
                bool t=false;
                rep(k,6) if(dp[i][j][k]!=0) t=true;
                if(t) continue;
                rep(k,6){
                    dp[i][j][k]=cnt[k];
                }
                int score=0;
                rep(ii,6){
                    rep(k,6){
                        int sum=0;
                        rep(jj,6){
                            sum+=dp[ii][jj][k];
                        }
                        score+=sum*sum;
                    }
                }
                rep(jj,6){
                    rep(k,6){
                        int sum=0;
                        rep(ii,6){
                            sum+=dp[ii][jj][k];
                        }
                        score+=sum*sum;
                    }
                }
                if(max_score<score){
                    pi=i;
                    pj=j;
                    max_score=score;
                }
                rep(k,6){
                    dp[i][j][k]=0;
                }
            }
        }
        rep(k,6){
            dp[pi][pj][k]=cnt[k];
        }
        cout << pi+1 << " " << pj+1 << endl;
    }
}
0