Submission #54124561
Source Code Expand
Copy
#include <iostream>#include <vector>#include <algorithm>using namespace std;int main() {int N;cin >> N;vector<int> A(N);for (int i = 0; i < N; ++i) {cin >> A[i];}// Sort the arraysort(A.begin(), A.end());long long result = 0;// Calculate contributionsfor (int i = 0; i < N; ++i) {for (int j = i + 1; j < N; ++j) {result += (A[j] / A[i]);
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int N; cin >> N; vector<int> A(N); for (int i = 0; i < N; ++i) { cin >> A[i]; } // Sort the array sort(A.begin(), A.end()); long long result = 0; // Calculate contributions for (int i = 0; i < N; ++i) { for (int j = i + 1; j < N; ++j) { result += (A[j] / A[i]); } } cout << result << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Max/Min |
User | turquoise |
Language | C++ 17 (gcc 12.2) |
Score | 0 |
Code Size | 518 Byte |
Status | TLE |
Exec Time | 2210 ms |
Memory | 4248 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 475 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | min_01.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
min_01.txt | AC | 1 ms | 3540 KB |
random_01.txt | TLE | 2207 ms | 4076 KB |
random_02.txt | TLE | 2207 ms | 3552 KB |
random_03.txt | TLE | 2207 ms | 4092 KB |
random_04.txt | TLE | 2207 ms | 3936 KB |
random_05.txt | TLE | 2207 ms | 4248 KB |
random_06.txt | TLE | 2207 ms | 4028 KB |
random_07.txt | TLE | 2207 ms | 4056 KB |
random_08.txt | AC | 1043 ms | 3608 KB |
random_09.txt | TLE | 2207 ms | 4152 KB |
random_10.txt | TLE | 2207 ms | 3652 KB |
random_11.txt | TLE | 2207 ms | 4032 KB |
random_12.txt | TLE | 2207 ms | 4000 KB |
random_13.txt | TLE | 2207 ms | 4080 KB |
random_14.txt | TLE | 2207 ms | 3772 KB |
random_15.txt | TLE | 2207 ms | 4152 KB |
random_16.txt | TLE | 2207 ms | 3636 KB |
random_17.txt | TLE | 2207 ms | 4032 KB |
random_18.txt | TLE | 2207 ms | 4036 KB |
random_19.txt | TLE | 2207 ms | 4076 KB |
random_20.txt | TLE | 2207 ms | 4160 KB |
random_21.txt | TLE | 2210 ms | 4052 KB |
sample_01.txt | AC | 1 ms | 3540 KB |
sample_02.txt | AC | 1 ms | 3484 KB |
sample_03.txt | AC | 1 ms | 3632 KB |