QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#794127 | #1087. Brief Statements Union | badminton | WA | 41ms | 51524kb | C++14 | 2.6kb | 2024-11-30 11:33:26 | 2024-11-30 11:33:32 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef pair <ll,ll> pll;
typedef pair <int,int> pii;
typedef pair <int,pii> piii;
#define forr(_a,_b,_c) for(int _a = (_b); _a <= int (_c); ++_a)
#define ford(_a,_b,_c) for(int _a = (_b) + 1; _a --> int (_c);)
#define forf(_a,_b,_c) for(int _a = (_b); _a < int (_c); ++_a)
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define mask(i) (1LL << (i))
#define bit(x, i) (((x) >> (i)) & 1)
#define bp __builtin_popcountll
#define file "test"
template<class X, class Y>
bool minz(X &x, const Y &y) {
if (x > y) {
x = y;
return true;
} return false;
}
template<class X, class Y>
bool maxz(X &x, const Y &y) {
if (x < y) {
x = y;
return true;
} return false;
}
const int N = 1e6 + 5;
const ll oo = (ll) 1e16;
const ll mod = 1e9 + 7; // 998244353;
ll x[N], l[N], r[N], id[N], add[N], n, k, ok[N];
vector <ll> ask[N];
void solve(int o){
memset (add, 0, sizeof add);
memset (id, 0, sizeof id);
forr (i, 1, k){
if (bit(x[i], o)){
add[l[i]]++;
add[r[i] + 1]--;
id[l[i]] = i;
} else {
ask[r[i]].pb(i);
}
}
int lst = 0, cur = 0;
vector <int> bad;
forr (i, 1, n){
add[i] += add[i - 1];
if (!add[i]) lst = i;
if (id[i] && r[id[i]] >= r[cur]){
cur = id[i];
}
id[i] = cur;
for (int u : ask[i]){
if (lst < l[u]){
bad.pb(u);
}
}
ask[i].clear();
}
if (bad.empty()){
forr (i, 1, k){
ok[i]++;
}
} else {
if (bad.size() == 1) ok[bad[0]]++;
int ml = mod, mr = -1;
for (int u : bad){
minz(ml, l[u]);
maxz(mr, r[u]);
}
if (ml > mr) return;
forr (i, ml, mr){
if (add[i] == 1){
ok[id[i]]++;
}
}
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
freopen(file".inp", "r", stdin); freopen(file".out", "w", stdout);
#endif
cin >> n >> k;
forr (i, 1, k){
cin >> l[i] >> r[i] >> x[i];
}
forf (i, 0, 60){
solve(i);
}
forr (i, 1, k){
cout << (ok[i] == 60);
}
return 0;
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 41ms
memory: 51524kb
input:
4 3 1 2 1 2 4 3 2 2 1
output:
011
result:
ok "011"
Test #2:
score: 0
Accepted
time: 37ms
memory: 42672kb
input:
4 3 1 2 1 3 4 3 2 3 1
output:
111
result:
ok "111"
Test #3:
score: -100
Wrong Answer
time: 34ms
memory: 51212kb
input:
8 8 1 3 23 2 8 8 2 4 10 3 3 26 1 3 26 1 4 10 4 7 8 4 5 40
output:
00000000
result:
wrong answer 1st words differ - expected: '10000000', found: '00000000'