提出 #70866637
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
void rotate(bitset<1000000> &bits, int size){
// bits[size] =
// bits[size-1]=0;
bits<<=1;
bits[0]=bits[size];
bits[size]=0;
// bits[0]=bits[size-1];
// bits[0]=bit;/**/
}
void solve(){
string a,b;
cin >> a >> b;
bitset<1000000> ba(a);
bitset<1000000> bb(b);
int s = a.size();
for(int i=0; i<s; i++){
// cout << ba << "\n";
if(ba==bb){
cout << i<<"\n";
return;
}
rotate(ba, s);
}
// bitset<40> test = 1;
// for(int i=0; i<40; i++){
// cout << test << "\n";
// rotate(test, 40);
// }
cout << "-1\n";
}
int main()
{
int tc;
cin >> tc;
while(tc--){
solve();
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Candy Cookie Law |
| ユーザ | ashfn |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 0 |
| コード長 | 770 Byte |
| 結果 | RE |
| 実行時間 | 96 ms |
| メモリ | 4128 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 100 | ||||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, sample_01.txt, sample_02.txt, sample_03.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| random_01.txt | RE | 95 ms | 3712 KiB |
| random_02.txt | RE | 95 ms | 3788 KiB |
| random_03.txt | RE | 94 ms | 3816 KiB |
| random_04.txt | RE | 95 ms | 3860 KiB |
| random_05.txt | RE | 94 ms | 4128 KiB |
| random_06.txt | RE | 95 ms | 3776 KiB |
| random_07.txt | RE | 94 ms | 3824 KiB |
| random_08.txt | RE | 95 ms | 3904 KiB |
| random_09.txt | RE | 94 ms | 3776 KiB |
| sample_01.txt | RE | 94 ms | 4128 KiB |
| sample_02.txt | RE | 96 ms | 3836 KiB |
| sample_03.txt | WA | 2 ms | 3840 KiB |