結果
| 問題 | No.3562 Communicate Sorted Vector |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-30 01:10:52 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,105 bytes |
| 記録 | |
| コンパイル時間 | 2,476 ms |
| コンパイル使用メモリ | 221,660 KB |
| 実行使用メモリ | 8,228 KB |
| 最終ジャッジ日時 | 2026-05-30 01:11:31 |
| 合計ジャッジ時間 | 9,004 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| 部分点1 | 10 % | TLE * 1 -- * 44 |
| 部分点2 | 25 % | -- * 45 |
| 部分点3 | 65 % | -- * 46 |
| 合計 | 0 点 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
string s; cin >> s;
if(s.at(0) == 'A'){
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);
int sum = 0,low = 1001001001;
vector<string> S(N);
for(int i=1; i<=N; i++){
int d = A.at(i)-A.at(i-1);
cout << d << " "; cout << endl;
low = min(low,d);
string s = "";
while(d) s += d%2+'0',d /= 2;
reverse(s.begin(),s.end());
if(s.size() == 0) s = '0';
S.at(i-1) = s,sum += s.size();
}
if(sum > Q) for(int i=1,first=1; i<=N; i++){
if(i == 1) sum = 0;
int d = A.at(i)-A.at(i-1);
if(d == low && first){
first = 0;
string s = "";
while(d) s += d%2+'0',d /= 2;
reverse(s.begin(),s.end());
if(s.size() == 0) s = '0';
s.insert(s.begin(),'0');
S.at(i-1) = s,sum += s.size();
}
else{
d -= low;
string s = "";
while(d) s += d%2+'0',d /= 2;
reverse(s.begin(),s.end());
if(s.size() == 0) s = '0';
S.at(i-1) = s,sum += s.size();
}
}
assert(sum <= Q);
cout << S.size() << "\n";
for(auto s : S) cout << s << "\n";
}
else{
int N,Q,K; cin >> N >> Q >> K;
vector<string> S(K);
int low = 0;
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';
if(S.at(i).at(0) == '0' && S.at(i).size() > 1) low = d+1,A.at(i) = now;
else now += d,A.at(i) = now;
}
for(int i=0; i<N; i++) cout << A.at(i)+low*(i+1) << (i+1==N?"\n":" ");
}
}