Pagini recente »
Clasament adunare
|
Istoria paginii runda/vaslui_cls10_23.02
|
Istoria paginii runda/s26_lab8_5/clasament
|
Istoria paginii utilizator/stoicamihnea
|
Cod sursă (job #578860)
Cod sursă (job
#578860)
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
const ll mod=1e9+7;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
#define rc(x) return cout<<x<<"\n",0
#define sz(s) (int) s.size()
#define pb push_back
#define mp make_pair
#define fr first
#define sc secondne all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define PI 3.14159265358979
using namespace std;
unsigned v[50009];
int n,d,l,c;
int val, final;
void primul(int x, int bit) {
unsigned mask=~(1<<(x&31));
v[x>>5]=(v[x>>5]&mask)^(bit<<(x&31));
}
void transfer(int n) {
for(int i=n/32+1; i>=1; i--) {
v[i]^=v[i]<<1;
v[i]^=v[i-1]>>31;
}
v[0]^=v[0]<<1;
}
int valoare(int x) {
return (v[x>>5]>>(x&31))&1;
}
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ifstream cin("beculete.in");
ofstream cout("beculete.out");
cin >> n >> d;
primul(0,1);
for(int i=1; i<n; i++) {
final=valoare(i-1);
transfer(i);
primul(i,final);
while(l<=i) {
if(l==i)primul(c,val);
if(d) {
cin>>l>>c>>val;
l--;
c--;
d--;
}
else l=n;
}
}
for(int i=0; i<n; i++)cout << valoare(i) << " ";
}
/*
100 50
4 2 1
8 3 1
15 9 1
15 12 1
18 2 0
22 16 1
30 21 0
30 30 1
31 21 0
32 5 0
36 22 1
38 11 1
40 25 1
41 8 1
43 5 0
43 21 0
44 27 0
47 22 0
49 26 1
50 24 0
52 48 1
53 24 1
53 30 1
56 48 1
60 41 1
60 42 1
63 22 1
63 25 1
64 36 0
64 37 0
65 54 0
73 61 1
74 68 1
78 8 1
79 4 0
80 26 1
82 77 0
89 6 1
90 7 1
90 9 1
90 31 1
92 55 0
93 72 0
93 85 0
96 95 1
97 54 0
97 84 0
100 10 1
100 29 1
100 72 0
*/