結果
問題 | No.2300 Substring OR Sum |
ユーザー |
![]() |
提出日時 | 2023-05-16 10:52:23 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,223 bytes |
コンパイル時間 | 8,581 ms |
コンパイル使用メモリ | 272,732 KB |
最終ジャッジ日時 | 2025-02-13 00:48:33 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 TLE * 1 |
ソースコード
#pragma target("popcnt")#pragma GCC optimize("O3")#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef string str;typedef pair<ll,ll> pii;#define F first#define S second#define pb push_back#define pq priority_queue#define all(x) (x).begin(),(x).end()#define bug(x) cerr << (x) << ' '#define debug(x) cerr << #x << " = " << x << '\n'#define yn(x) cout << (x==1?"Yes\n":"No\n")#define PI 3.14159265358979323#define Ststone ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)const ll max_n=1e5+10,max_int=2147483647,mod1=1e9+7,mod2=998244353;ll t,n,m,h,w,a,b,c,d,q;long long ans=0;vector<ll> v,v1,v2;//str s1,s2,s;set<ll> s1,s2,ss;void solve(){cin >> n;for(ll i=0;i<n;i++){cin >> a;v.pb(a);}ll ans = 0;for(ll i=0;i<30;i++){ss.clear();for(ll j=0;j<n;j++){if(v[j]&(1<<i)) ss.insert(j);}ss.insert(mod1);for(ll j=0;j<n;j++){ll x = *ss.lower_bound(j);if(x!=mod1){ans += (1<<i) * (n-x);}}}cout << ans << '\n';}int main(){Ststone;//cin >> t;t = 1;while(t--){solve();}}/**/