Submission #20711775
Source Code Expand
Copy
#include <bits/stdc++.h>using namespace std;int main(){ios::sync_with_stdio(false);int n;cin >>n;int memo[n][2];int less = numeric_limits<int>::max();for(int i = 0; i < n; i++){cin>>memo[i][0]>>memo[i][1];less = min(less, memo[i][0] + memo[i][1]);}int a = numeric_limits<int>::max(), b = numeric_limits<int>::max();int tha, thb;for(int i = 0; i < n; i++){if(a > memo[i][0]){a = memo[i][0];tha=i;}
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); int n; cin >>n; int memo[n][2]; int less = numeric_limits<int>::max(); for(int i = 0; i < n; i++){ cin>>memo[i][0]>>memo[i][1]; less = min(less, memo[i][0] + memo[i][1]); } int a = numeric_limits<int>::max(), b = numeric_limits<int>::max(); int tha, thb; for(int i = 0; i < n; i++){ if(a > memo[i][0]){ a = memo[i][0]; tha=i; } if(b > memo[i][1]){ b = memo[i][1]; thb=i; } } int keepa = numeric_limits<int>::max(), keepb = numeric_limits<int>::max(); for(int i = 0; i < n; i++){ if(keepa > memo[i][0] and i != thb){ keepa = memo[i][0]; //tha=i; } if(keepb > memo[i][1] and i != tha){ keepb = memo[i][1]; //thb=i; } } //cout<<less<<" "<<max(a, keepb)<<" "<<max(b, keepa)<<"\n"; cout<<min(less, min(max(a, keepb), max(b, keepa)))<<"\n"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Job Assignment |
User | Vliberty |
Language | C++ (GCC 9.2.1) |
Score | 200 |
Code Size | 945 Byte |
Status | AC |
Exec Time | 7 ms |
Memory | 3664 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:34:25: warning: ‘tha’ may be used uninitialized in this function [-Wmaybe-uninitialized] 34 | if(keepb > memo[i][1] and i != tha){ | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~ ./Main.cpp:30:25: warning: ‘thb’ may be used uninitialized in this function [-Wmaybe-uninitialized] 30 | if(keepa > memo[i][0] and i != thb){ | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt |
All | handmade_00.txt, handmade_01.txt, handmade_02.txt, handmade_03.txt, handmade_04.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_duplicate_00.txt, random_duplicate_01.txt, random_duplicate_02.txt, random_duplicate_03.txt, sample_01.txt, sample_02.txt, single_00.txt, single_01.txt, single_02.txt, single_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
handmade_00.txt | AC | 7 ms | 3512 KB |
handmade_01.txt | AC | 2 ms | 3456 KB |
handmade_02.txt | AC | 2 ms | 3536 KB |
handmade_03.txt | AC | 2 ms | 3508 KB |
handmade_04.txt | AC | 2 ms | 3592 KB |
random_00.txt | AC | 2 ms | 3516 KB |
random_01.txt | AC | 2 ms | 3512 KB |
random_02.txt | AC | 2 ms | 3512 KB |
random_03.txt | AC | 2 ms | 3664 KB |
random_04.txt | AC | 2 ms | 3588 KB |
random_05.txt | AC | 2 ms | 3572 KB |
random_duplicate_00.txt | AC | 3 ms | 3552 KB |
random_duplicate_01.txt | AC | 2 ms | 3552 KB |
random_duplicate_02.txt | AC | 2 ms | 3516 KB |
random_duplicate_03.txt | AC | 2 ms | 3472 KB |
sample_01.txt | AC | 2 ms | 3460 KB |
sample_02.txt | AC | 2 ms | 3588 KB |
single_00.txt | AC | 2 ms | 3552 KB |
single_01.txt | AC | 3 ms | 3600 KB |
single_02.txt | AC | 2 ms | 3632 KB |
single_03.txt | AC | 2 ms | 3600 KB |