Submission #289542

#TimeUsernameProblemLanguageResultExecution timeMemory
289542cheetose벽 (IOI14_wall)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define X first #define Y second #define y0 y12 #define y1 y22 #define INF 987654321987654321 #define PI 3.141592653589793238462643383279502884 #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c)) #define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c)) #define MEM0(a) memset((a),0,sizeof(a)); #define MEM_1(a) memset((a),-1,sizeof(a)); #define ALL(a) a.begin(),a.end() #define SYNC ios_base::sync_with_stdio(false);cin.tie(0) using namespace std; typedef long long ll; typedef long double ld; typedef double db; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int, int> Pi; typedef pair<ll, ll> Pll; typedef pair<ld, ld> Pd; typedef vector<int> Vi; typedef vector<ll> Vll; typedef vector<db> Vd; typedef vector<Pi> VPi; typedef vector<Pll> VPll; typedef vector<Pd> VPd; typedef tuple<int, int, int> iii; typedef tuple<int, int, int, int> iiii; typedef tuple<ll, ll, ll> LLL; typedef vector<iii> Viii; typedef vector<LLL> VLLL; typedef complex<double> base; const int MOD = 993244853; ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; } ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); } int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 }; int ddx[] = { -1,-2,1,-2,2,-1,2,1 }, ddy[] = { -2,-1,-2,1,-1,2,1,2 }; int mntree[1<<22], mxtree[1<<22], lazy[1<<22]; void propagation(int node, int S, int E) { if (lazy[node] != -1) { mntree[node] = mxtree[node] = lazy[node]; if (S != E) { lazy[2 * node] = lazy[node]; lazy[2 * node + 1] = lazy[node]; } lazy[node] = -1; } } void upd(int node, int S, int E, int i, int j, int op, int val) { propagation(node, S, E); if (i > E || j < S) return; if (j >= E && i <= S) { if((op==1 && mxtree[node]<=val) || (op==2 && mntree[node]>=val)){ lazy[node]=val; propagation(node,S,E); return; } } if(S==E)return; upd(2 * node, S, (S + E) / 2, i, j, op, val); upd(2 * node + 1, (S + E) / 2 + 1, E, i, j, op, val); mntree[node] = min(mntree[2 * node], mntree[2 * node + 1]); mxtree[node] = max(mxtree[2 * node], mxtree[2 * node + 1]); } int find(int node,int S,int E,int i,int j){ propagation(node, S, E); if (i > E || j < S) return -1; if (j >= E && i <= S) return mxtree[node]; return max(find(node * 2, S, (S + E) / 2, i, j), find(2 * node + 1, (S + E) / 2 + 1, E, i, j)); } int main() { MEM_1(lazy); int n,q; scanf("%d%d",&n,&q); while(q--){ int o,l,r,x; scanf("%d%d%d%d",&o,&l,&r,&x); upd(1,0,n-1,l,r,o,x); } fup(i,0,n-1,1)printf("%d\n",find(1,0,n-1,i,i)); }

Compilation message (stderr)

wall.cpp: In function 'int main()':
wall.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
wall.cpp:91:2: note: in expansion of macro 'fup'
   91 |  fup(i,0,n-1,1)printf("%d\n",find(1,0,n-1,i,i));
      |  ^~~
wall.cpp:85:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   85 |  scanf("%d%d",&n,&q);
      |  ~~~~~^~~~~~~~~~~~~~
wall.cpp:88:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   88 |   scanf("%d%d%d%d",&o,&l,&r,&x);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ccMGQwox.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccBjQMh3.o:wall.cpp:(.text.startup+0x0): first defined here
/tmp/ccMGQwox.o: In function `main':
grader.cpp:(.text.startup+0x118): undefined reference to `buildWall(int, int, int*, int*, int*, int*, int*)'
collect2: error: ld returned 1 exit status