제출 #315188

#제출 시각아이디문제언어결과실행 시간메모리
315188xyzyzlRabbit Carrot (LMIO19_triusis)C++14
100 / 100
232 ms13956 KiB
// Time:
// Algorithms:

#include <bits/stdc++.h>

#pragma GCC optimize("O3")

using namespace std;

#define MAXN 1000005

#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORR(j, i, n) for (int i = j; i < n; i++)
#define FORD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOBIR(i, n) for (int i = 1; i <= n; i++)
#define FOBIRD(i, n) for (int i = n; i >= 1; i--)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define DUEHOANG                  \
	ios_base::sync_with_stdio(0); \
	cin.tie(NULL);                \
	cout.tie(NULL)

#define fileio(in, out)      \
	freopen(in, "r", stdin); \
	freopen(out, "w", stdout);

#define ll long long
#define INF (1e9 * 1) + 5

typedef set<int> si;
typedef multiset<int> msi;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pii> iii;
typedef vector<pii> vii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef stack<int> sti;
typedef queue<int> qi;
typedef deque<int> di;
typedef map<int, int> mii;
#define f first
#define s second

#define LEFT(x) 2 * x
#define RIGHT(x) 2 * x + 1

#define bitinc(x) x & -x

const int MAX(int &a, int b)
{
	return a = max(a, b);
}
const int MIN(int &a, int b)
{
	return a = min(a, b);
}

int lis(vi v)
{
	msi st;
	msi::iterator it;
	st.clear();
	FOR(i, (v.size()))
	{
		if(v[i] < 0) continue;
		st.insert(v[i]);
		it = st.upper_bound(v[i]);
		if (it != st.end())
			st.erase(it);
	}
	return st.size();
}

int n,m;
vi a,x;
int main()
{
	cin >> n >> m;
	a.assign(n, 0);
	x.assign(n, 0);
	FOR(i, n)
		cin >> a[i];
	FOR(i, n)
	{
		x[i] = m*(i+1)-a[i];
	}
	cout << n-lis(x) << endl;
}

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

triusis.cpp: In function 'int lis(vi)':
triusis.cpp:12:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | #define FOR(i, n) for (int i = 0; i < n; i++)
......
   66 |  FOR(i, (v.size()))
      |      ~~~~~~~~~~~~~                   
triusis.cpp:66:2: note: in expansion of macro 'FOR'
   66 |  FOR(i, (v.size()))
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...