Submission #884460

# Submission time Handle Problem Language Result Execution time Memory
884460 2023-12-07T11:59:29 Z lalig777 Sirni (COCI17_sirni) C++14
0 / 140
5000 ms 1884 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;


int main(){
	int n;
	cin>>n;
	vector<int>cards(n);
	vector<int>minimums(n, 1e9);
	for (int i=0; i<n; i++) cin>>cards[i];
	sort(cards.begin(), cards.end());
	int ans=0;
	for (int i=0; i<n; i++){
		for (int j=i+1; j<n; j++){
			if (cards[j]%cards[i]==0){
				minimums[i]=0;
				minimums[j]=0;
			}else{
				int mini=min(cards[j]%cards[i], cards[i]);
				minimums[i]=min(minimums[i], mini);
				minimums[j]=min(minimums[j], mini);
			}
		}ans+=minimums[i];
	}cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5051 ms 1884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 482 ms 620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5054 ms 1884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3458 ms 964 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5100 ms 1880 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5028 ms 1884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 961 ms 852 KB Output isn't correct
2 Halted 0 ms 0 KB -