답안 #154544

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
154544 2019-09-22T15:52:35 Z hentai_lover Intergalactic ship (IZhO19_xorsum) C++14
9 / 100
2000 ms 3680 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define lft(x) x * 2
#define rgt(x) x * 2 + 1

#define tm hui_pizda
#define ft first
#define sd second
#define pb push_back
#define pf push_front
#define sz size()
#define cnt continue
#define m_p make_pair
#define fr(i, l, r) for(int i = l; i <= r; ++ i)
#define rf(i, r, l) for(int i = r; i >= l; -- i)
#pragma GCC optimize(-O3)
#pragma GCC optimize(Ofast)
#pragma GCC optimize("unroll-loops")

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using _set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;

typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <pii> vpi;
typedef vector <pll> vpl;

mt19937_64 rnd(time(NULL));

const ll N = 1e6 + 10;
const ll mtrxN = 10;
const ll oo = 1e18 + 10;
//const ll oo = 228;
const ll B = 500;
const ll mod = 1e9 + 7;

struct mtrx{
    ll m[mtrxN][mtrxN] = {};
};
mtrx mtrx_mult(mtrx a, mtrx b){
    mtrx c;
    fr(i, 0, mtrxN - 1){
        fr(j, 0, mtrxN - 1){
            ll sum = 0;
            fr(x, 0, mtrxN - 1){
                sum += a.m[i][x] * b.m[x][j];
                sum %= mod;
            }
            c.m[i][j] = sum;
        }
    }
    return c;
}
mtrx mtrx_pow(mtrx a, ll n){
    mtrx res;
    fr(i, 0, mtrxN - 1)fr(j, 0, mtrxN - 1)res.m[i][j] = a.m[i][j];
    n --;
    while(n){
        if(n&1)res = mtrx_mult(res, a);
        a = mtrx_mult(a, a);
        n >>= 1;
    }
    return res;
}
ll _pow(ll a, ll n){
    ll r = 1;
    while(n){
        if(n&1)r = r * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return r;
}
ll div(ll x, ll y, ll md){
    return x * _pow(y, md - 2) % md;
}

ll l[N], r[N], a[N], b[N], x[N], d[N];
ll n, Q, ans;

int main(){
    cin >> n;
    fr(i, 1, n)cin >> a[i];
    cin >> Q;
    fr(i, 0, Q - 1)cin >> l[i] >> r[i] >> x[i];
    fr(i, 0, (1<<Q) - 1){
        fr(j, 1, n)b[j] = a[j];
        fr(j, 0, Q - 1){
            ll mask = (i & (1<<j));
            if(mask)
                fr(w, l[j], r[j])b[w] ^= x[j];
        }
        fr(i, 1, n){
            ll sum = 0;
            fr(j, i, n){
                sum += b[j];
                ans += sum * sum;
                ans %= mod;
            }
        }
        //cout << "             " << ans << endl;
    }
    cout << ans;
    return 0;
}
/*
строки +
столбцы -
*/

Compilation message

xorsum.cpp:17:22: warning: '#pragma GCC optimize' is not a string or number [-Wpragmas]
 #pragma GCC optimize(-O3)
                      ^
xorsum.cpp:18:22: warning: '#pragma GCC optimize' is not a string or number [-Wpragmas]
 #pragma GCC optimize(Ofast)
                      ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 30 ms 376 KB Output is correct
7 Correct 29 ms 376 KB Output is correct
8 Correct 30 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 102 ms 3680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2036 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2050 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2050 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 30 ms 376 KB Output is correct
7 Correct 29 ms 376 KB Output is correct
8 Correct 30 ms 376 KB Output is correct
9 Execution timed out 2050 ms 376 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 30 ms 376 KB Output is correct
7 Correct 29 ms 376 KB Output is correct
8 Correct 30 ms 376 KB Output is correct
9 Execution timed out 2050 ms 376 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 30 ms 376 KB Output is correct
7 Correct 29 ms 376 KB Output is correct
8 Correct 30 ms 376 KB Output is correct
9 Incorrect 102 ms 3680 KB Output isn't correct
10 Halted 0 ms 0 KB -