답안 #374072

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
374072 2021-03-06T14:35:15 Z Nimbostratus Baloni (COCI15_baloni) C++17
0 / 100
14 ms 4460 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define clean(a,s) memset((a),0,sizeof((a)[0])*(s))
#define all(x) (x).begin() , (x).end()
#define fi first
#define se second
#define int int
using pii = pair<int,int>;
using ll = long long;
const int maxn = 1e5+5;
const int inf = 2e9;
const int mod = 1e9+7;

int n,a[maxn],ans;
vector<int> occ[maxn];

int32_t main () {
	//freopen("in","r",stdin); freopen("out","w",stdout);
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	cin >> n;
	for(int i=1;i<=n;i++) cin >> a[i] , occ[a[i]].pb(i);
	ans = 1;
	for(int i=2;i<=n;i++) {
		int pos = lb(all(occ[a[i]+1]),i)-occ[a[i]+1].begin()-1;
		if(pos >= occ[a[i]].size() || pos < 0 || *lb(all(occ[a[i]]),occ[a[i]+1][pos]) < i)
			ans++;
	}
	cout << ans << endl;
}	
	

Compilation message

baloni.cpp: In function 'int32_t main()':
baloni.cpp:28:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   if(pos >= occ[a[i]].size() || pos < 0 || *lb(all(occ[a[i]]),occ[a[i]+1][pos]) < i)
      |      ~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2668 KB Output isn't correct
2 Incorrect 2 ms 2668 KB Output isn't correct
3 Incorrect 3 ms 2796 KB Output isn't correct
4 Incorrect 3 ms 2796 KB Output isn't correct
5 Incorrect 14 ms 4332 KB Output isn't correct
6 Incorrect 13 ms 4352 KB Output isn't correct
7 Incorrect 12 ms 4460 KB Output isn't correct
8 Incorrect 12 ms 4460 KB Output isn't correct
9 Incorrect 13 ms 4460 KB Output isn't correct
10 Incorrect 12 ms 4332 KB Output isn't correct