Submission #375358

# Submission time Handle Problem Language Result Execution time Memory
375358 2021-03-09T10:06:39 Z muhi1112 Po (COCI21_po) C++17
20 / 70
65 ms 4740 KB
#include <bits/stdc++.h>
using namespace std;

#define f1 first
#define s2 second
#define INF 99999999
#define ll long long
#define pb push_back
#define fri(a) freopen(a,"r",stdin)
#define fro(a) freopen(a,"w",stdout)
const int N=2e5+5;

vector<int>v;
set<int>s;
int n,dizi[N],ans;

void solve(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>dizi[i];
	}
	v.pb(-1);
	for(int i=1;i<n-1;i++){
		if(dizi[i-1]>dizi[i] && dizi[i]<dizi[i+1]){
			v.pb(i);
		}
	}
	v.pb(n-1);
	for(int i=1;i<v.size();i++){
		//cout<<v[i]<<endl;
		for(int j=v[i-1]+1;j<=v[i];j++){
			s.insert(dizi[j]);
		}
		ans+=s.size();
		s.clear();
	}
	cout<<ans<<endl;
}

int main(){

	//fri("in.txt");
	//fro("out.txt");
	solve();

	return 0;
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:29:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i=1;i<v.size();i++){
      |              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Incorrect 16 ms 748 KB Output isn't correct
5 Incorrect 18 ms 1004 KB Output isn't correct
6 Correct 56 ms 3564 KB Output is correct
7 Incorrect 65 ms 4740 KB Output isn't correct