제출 #438848

#제출 시각아이디문제언어결과실행 시간메모리
438848Valera_GrinenkoRabbit Carrot (LMIO19_triusis)C++17
100 / 100
99 ms12348 KiB
#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization ("unroll-loops") #include <iostream> #include <fstream> #include <algorithm> #include <vector> #include <set> #include <stack> #include <map> #include <unordered_map> #include <iomanip> #include <cmath> #include <queue> #include <bitset> #include <numeric> #include <array> #include <cstring> #include <random> #include <chrono> #define fi first #define se second #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin()) typedef long long ll; typedef long double ld; using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // template<class T> // using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; const int N = 2e5 + 42; int fw[N]; void upd(int k, int x) { for(; k < N; k += (k & -k)) fw[k] = max(fw[k], x); } int get(int k) { int res = 0; for(; k > 0; k -= (k & -k)) res = max(res, fw[k]); return res; } int n, m; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; vector<int> a; for(int i = 1; i <= n; i++) { int x; cin >> x; if(i * m - x >= 0) a.pb(i * m - x); } auto p = a; make_unique(p); map<int, int> nind; for(int i = 0; i < p.size(); i++) nind[p[i]] = i + 1; for(auto& x : a) x = nind[x]; for(auto& x : a) { upd(x, get(x) + 1); } cout << n - get(N - 1); return 0; } /* */

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

triusis.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("unroll-loops")
      | 
triusis.cpp: In function 'int main()':
triusis.cpp:67:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |   for(int i = 0; i < p.size(); i++) nind[p[i]] = i + 1;
      |                  ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...