提出 #40049068
ソースコード 拡げる
# include <bits/stdc++.h>
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
# define endl '\n'
# define deb(x) cout << #x << " = " << x << endl
# define ll long long
# define f first
# define s second
# define siz(x) (ll)(x).size()
# define vll vector<ll>
# define pll pair<ll,ll>
# define all(x) (x).begin(), (x).end()
# define YES cout<<"Yes"<<endl
# define NO cout<<"No"<<endl
//Namespaces
using namespace __gnu_pbds;
using namespace std;
//Templates
template<typename T>
using ordered_set= tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<typename T>
using ordered_multiset = tree<T,null_type,less_equal<T>,rb_tree_tag, tree_order_statistics_node_update>; //less_equal=ms can have duplicates
//order_of_key (K): Number of items strictly smaller than K.
//find_by_order(K): Kth element in a Set (counting from zero).
//Constants
const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 9;
const ll N = 2e5 + 1;
//For fileIO
void setIO(string name) {
#ifndef ONLINE_JUDGE
if((int)name.size() > 0){
freopen((name+".in").c_str(), "r", stdin);
freopen((name+".out").c_str(), "w", stdout);
}
#endif
}
//bexpo
ll binpow(ll a, ll b, ll m) {
a %= m;
ll res = 1;
while (b > 0) {
if (b & 1)
res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
void solve();
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//setIO("sublime");
ll TC = 1;
//cin >> TC;
for(int i=0;i<TC;++i){
//cout << "Case #" << i+1 << ": ";
solve();
}
return 0;
}
void solve(){
string s; cin >> s;
ll n = siz(s);
ll px = 0;
map<ll,ll> odd,eve;
ll ans = 0;
odd[0]=1;
for(int i=0;i<n;++i){
px = (px^(1ll<<(s[i]-'0')));
if(i%2){
ans+=odd[px];
odd[px]++;
}else{
ans+=eve[px];
eve[px]++;
}
}
cout << ans << endl;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Three Days Ago |
| ユーザ | enough_cpi |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 400 |
| コード長 | 2067 Byte |
| 結果 | AC |
| 実行時間 | 61 ms |
| メモリ | 3840 KiB |
コンパイルエラー
./Main.cpp: In function ‘void setIO(std::string)’:
./Main.cpp:35:19: warning: unused parameter ‘name’ [-Wunused-parameter]
35 | void setIO(string name) {
| ~~~~~~~^~~~
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| sample_01.txt | AC | 8 ms | 3516 KiB |
| sample_02.txt | AC | 2 ms | 3560 KiB |
| sample_03.txt | AC | 3 ms | 3580 KiB |
| test_01.txt | AC | 2 ms | 3576 KiB |
| test_02.txt | AC | 2 ms | 3376 KiB |
| test_03.txt | AC | 10 ms | 3840 KiB |
| test_04.txt | AC | 12 ms | 3768 KiB |
| test_05.txt | AC | 25 ms | 3580 KiB |
| test_06.txt | AC | 29 ms | 3576 KiB |
| test_07.txt | AC | 38 ms | 3840 KiB |
| test_08.txt | AC | 20 ms | 3644 KiB |
| test_09.txt | AC | 12 ms | 3684 KiB |
| test_10.txt | AC | 30 ms | 3740 KiB |
| test_11.txt | AC | 10 ms | 3748 KiB |
| test_12.txt | AC | 31 ms | 3580 KiB |
| test_13.txt | AC | 39 ms | 3692 KiB |
| test_14.txt | AC | 13 ms | 3752 KiB |
| test_15.txt | AC | 60 ms | 3840 KiB |
| test_16.txt | AC | 59 ms | 3744 KiB |
| test_17.txt | AC | 59 ms | 3616 KiB |
| test_18.txt | AC | 59 ms | 3800 KiB |
| test_19.txt | AC | 61 ms | 3672 KiB |
| test_20.txt | AC | 61 ms | 3676 KiB |
| test_21.txt | AC | 11 ms | 3668 KiB |
| test_22.txt | AC | 17 ms | 3684 KiB |
| test_23.txt | AC | 12 ms | 3780 KiB |
| test_24.txt | AC | 9 ms | 3824 KiB |
| test_25.txt | AC | 9 ms | 3704 KiB |
| test_26.txt | AC | 12 ms | 3740 KiB |
| test_27.txt | AC | 45 ms | 3824 KiB |
| test_28.txt | AC | 16 ms | 3560 KiB |
| test_29.txt | AC | 55 ms | 3688 KiB |
| test_30.txt | AC | 57 ms | 3840 KiB |