제출 #314257

#제출 시각아이디문제언어결과실행 시간메모리
314257Trickster거래 (IZhO13_trading)C++14
100 / 100
730 ms10872 KiB
#include <algorithm> #include <string.h> #include <iostream> #include <stdio.h> #include <vector> #include <queue> #include <cmath> #include <set> #include <map> using namespace std; #define N 300010 #define ff first #define ss second #define ll long long #define pb push_back #define mod 1000000007 #define pii pair <int, int> #define sz(a) int(a.size()) #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") ll bigmod(ll a,ll e) {if(e==0)return 1;ll x=bigmod(a*a%mod,e>>1);return e&1?x*a%mod:x;} int n, q; int v[N]; int L[N*4]; void shift(int x, int to) { L[to] = max(x, L[to]); } void upd(int a, int b, int x, int l, int r, int node) { if(l > b || r < a) return; if(l >= a && r <= b) { // cout << l << " " << r << " " << x+l-a << "\n"; L[node] = max(x+l-a, L[node]); return; } if(L[node]) { shift(L[node], node*2); shift(L[node]+(l+r)/2-l+1, node*2+1); L[node] = 0; } upd(a, b, x, l, (l+r)/2, node*2); upd(a, b, x, (l+r)/2+1, r, node*2+1); } int tap(int pos, int l, int r, int node) { if(l == r) return L[node]; if(L[node]) { shift(L[node], node*2); shift(L[node]+(l+r)/2-l+1, node*2+1); L[node] = 0; } if(pos <= (l+r)/2) return tap(pos, l, (l+r)/2, node*2); else return tap(pos, (l+r)/2+1, r, node*2+1); } int main() { cin >> n >> q; while(q--) { int l, r, x; cin >> l >> r >> x; upd(l, r, x, 1, n, 1); } for(int i = 1; i <= n; i++) cout << tap(i, 1, n, 1) << " "; } /* 5 2 1 3 2 2 4 6 6 4 4 4 3 1 2 5 5 6 1 6 6 1 */

컴파일 시 표준 에러 (stderr) 메시지

trading.cpp:22: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
   22 | #pragma GCC optimization ("O3")
      | 
trading.cpp:23: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
   23 | #pragma GCC optimization ("unroll-loops")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...