結果
| 問題 |
No.3266 岩井星人は見ずにはいられない
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-11 20:45:56 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 993 bytes |
| コンパイル時間 | 14,222 ms |
| コンパイル使用メモリ | 258,584 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-09-11 20:46:17 |
| 合計ジャッジ時間 | 8,861 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 3 WA * 28 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); ++i)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define fore(i, a) for(auto &i:a)
using ll = long long;
#define DEBUG(x) cerr << #x << ": "; for (auto _ : x) cerr << _ << " "; cerr << endl;
int main() {
ll n,a; cin >> n >> a;
string s;cin >> s;
ll now = 1200;
ll ac1 = 0;
ll ac2 = 0;
vector<ll> ivent1, ivent2;
rep(i, n){
if(s[i] == '1' && now < 1200){
ac1++;
ivent1.push_back(i);
now++;
}
else if(s[i] == '0'){
now--;
}
}
rep(i, n){
if(s[i] == '1' && now < 1200){
ac2++;
ivent2.push_back(i);
now++;
}
else if(s[i] == '0'){
now--;
}
}
int ans;
if(a <= ac1){
ans = ivent1[a-1]+1;
}
else{
a -= ac1;
auto[q, r] = div(a, ac2);
if(r == 0){
ans = q*n+ivent2[ac2-1];
}
else{
ans = (q+1)*n+ivent2[r-1]+1;
}
}
cout << ans << endl;
}