제출 #386273

#제출 시각아이디문제언어결과실행 시간메모리
386273bytemaskRabbit Carrot (LMIO19_triusis)C++17
100 / 100
32 ms4712 KiB
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; struct custom_hash { static uint64_t splitmix64(uint64_t x) { // http://x...content-available-to-author-only...i.it/splitmix64.c x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM); } }; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define pb push_back #define eb emplace_back #define vi vector<int> #define vvi vector<vector<int>> #define vii vector<pii> #define pii pair<int,int> #define all(a) (a).begin(),(a).end() #define ff first #define ss second #define sp(n) setprecision(n)<<fixed #define endl '\n' #define umap unordered_map<long long, long long, custom_hash> mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char* name, Arg1&& arg1){ std::cerr << name << " : " << arg1 << endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); } template<typename T, typename U> static inline T amin(T &x, U y) { if (y < x) x = y; return x; } template<typename T, typename U> static inline T amax(T &x, U y) { if (x < y) x = y; return x; } inline void YN(int f){ cout<< "NO\0YES" + 3*f << endl; } inline void yn(int f){ cout<< "No\0Yes" + 3*f << endl; } inline void setIO(string name) { if(name.empty()) return ; freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } // -------------------Standard Traversal Moves--------------------- // vi fx = {1 ,-1 ,0, 0}, fy = {0, 0, -1, 1}; // vi fx = {2, -2, 2, -2, 1, -1, 1, -1}, fy = {1, 1, -1, -1, 2, 2, -2, -2}; // vi fx = {1, 1, 1, -1, -1 , -1, 0, 0}, fy = {1, -1, 0, 1, -1, 0, 1, -1}; // ---------------------------------------------------------------- // #define int long long const long long INF = LLONG_MAX/2; const int inf = INT_MAX/2; const int N = 2e5 + 5, K = 67, MOD = 1000000007; int a[N], b[N]; void solve(){ int n,m; cin>>n>>m; vi dp; for(int i=1; i<=n; i++){ cin>>a[i]; b[i] = i*m - a[i]; if(b[i]<0) continue; auto it = upper_bound(all(dp), b[i]); if(it == dp.end()) dp.pb(b[i]); else *it = b[i]; } cout<<n-dp.size(); } int32_t main() { IOS; string filename = ""; setIO(filename); int TESTS=1; // cin>>TESTS; while(TESTS--) { solve(); } // cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s."; return 0; }

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

triusis.cpp: In function 'void setIO(std::string)':
triusis.cpp:66:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   66 |     freopen((name+".in").c_str(),"r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:67:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   67 |     freopen((name+".out").c_str(),"w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...