結果

問題 No.3562 Communicate Sorted Vector
コンテスト
ユーザー GOTKAKO
提出日時 2026-05-30 00:48:35
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,027 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,004 ms
コンパイル使用メモリ 218,440 KB
実行使用メモリ 30,320 KB
平均クエリ数 3.00
最終ジャッジ日時 2026-05-30 00:48:52
合計ジャッジ時間 15,741 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
サブタスク 配点 結果
部分点1 10 % AC * 45
部分点2 25 % AC * 45
部分点3 65 % AC * 44 WA * 2
合計 35 点
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
 
    string s; cin >> s;
    if(s == "Alice"){
        int N,Q; cin >> N >> Q;
        vector<int> A(N);
        for(auto &a : A) cin >> a;
        for(int i=0; i<N; i++) A.at(i) -= i+1;
        A.insert(A.begin(),0);
        cout << N << "\n";
        for(int i=1; i<=N; i++){
            int d = A.at(i)-A.at(i-1);
            string s = "";
            while(d) s += d%2+'0',d /= 2;
            reverse(s.begin(),s.end());
            if(s.size() == 0) s = '0';
            cout << s << "\n";
        }
    }
    else{
        int N,Q,K; cin >> N >> Q >> K;
        vector<string> S(K);
        for(auto &s : S) cin >> s;
        vector<int> A(N);
        int now = 0;
        for(int i=0; i<N; i++){
            int d = 0;
            for(auto c : S.at(i)) d *= 2,d += c=='1';
            now += d,A.at(i) = now;
        }
        for(int i=0; i<N; i++) cout << A.at(i)+i+1 << (i+1==N?"\n":" ");
    }
}
0