Submission #1112475

# Submission time Handle Problem Language Result Execution time Memory
1112475 2024-11-14T08:37:38 Z vjudge1 Baloni (COCI15_baloni) C++17
100 / 100
760 ms 14296 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long 

int n,oksayi=1,ctrl=0;

int32_t main() {
	cin>>n;
	int arr[n];
	int ok[n];
	for(int i=0;i<n;i++){
		cin>>arr[i];
		ok[i]==-1;
	}
	ok[0]=arr[0];
	for(int i=0;i<n;i++){
		ctrl=0;
		for(int j=0;j<oksayi;j++){
			if(arr[i]==ok[j]){
				ok[j]--;
				ctrl=1;
				break;
			}
		}
		if(ctrl==0){
			ok[oksayi]=arr[i];
			ok[oksayi]--;
			oksayi++;
		}
	}
	cout<<oksayi;

}

Compilation message

baloni.cpp: In function 'int32_t main()':
baloni.cpp:14:8: warning: statement has no effect [-Wunused-value]
   14 |   ok[i]==-1;
      |   ~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 5 ms 496 KB Output is correct
4 Correct 4 ms 336 KB Output is correct
5 Correct 432 ms 12804 KB Output is correct
6 Correct 760 ms 14296 KB Output is correct
7 Correct 600 ms 11856 KB Output is correct
8 Correct 595 ms 11600 KB Output is correct
9 Correct 524 ms 12368 KB Output is correct
10 Correct 637 ms 12624 KB Output is correct