제출 #1034478

#제출 시각아이디문제언어결과실행 시간메모리
1034478coolsentenceidontrememberRabbit Carrot (LMIO19_triusis)C++17
100 / 100
19 ms6868 KiB
#include<bits/stdc++.h> #pragma GCC optimize("O3", "unroll-loops") #define ll long long #define ld long double #define ff first #define ss second #define db double #define time_begin() auto begin = chrono::high_resolution_clock::now() #define time_end() auto end = chrono::high_resolution_clock::now(); auto elapsed = chrono::duration_cast<chrono::nanoseconds>(end-begin); auto sec = elapsed.count() * 1e-9; cerr << "\n\nExecution time: " << sec << " seconds"; #define check_time() cerr << "\nStatus : "; if (sec>1) cerr << "Time Limit Exceeded 1!!!1!111"; else cerr << "You good brother" using namespace std; void setIO(string s = ""){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); if (!s.empty()){ freopen((s+".in").c_str(), "r", stdin); freopen((s+".out").c_str(), "w", stdout); } } int main(){ setIO(); int n, m; cin >> n >> m; vector<ll> ok; for (int i = 1; i <= n; i++){ ll a; cin >> a; if (1ll*m*i >= a) ok.push_back(1ll*m*i-a); } vector<ll> dp; for (const ll &x : ok){ int pos = upper_bound(dp.begin(), dp.end(), x) - dp.begin(); if (pos == dp.size()) dp.push_back(x); else dp[pos] = x; } cout << n-(int)dp.size(); }

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

triusis.cpp: In function 'int main()':
triusis.cpp:42:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     if (pos == dp.size()) dp.push_back(x);
      |         ~~~~^~~~~~~~~~~~
triusis.cpp: In function 'void setIO(std::string)':
triusis.cpp:22:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |  freopen((s+".in").c_str(), "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
triusis.cpp:23:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |  freopen((s+".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...