Submission #335385

# Submission time Handle Problem Language Result Execution time Memory
335385 2020-12-12T08:09:53 Z strawberry2005 Lost Array (NOI19_lostarray) C++14
32 / 100
11 ms 1644 KB
#include<bits/stdc++.h>
#define deb(x) cout << #x << ": " << x << endl
#define ll long long
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    int n,m;
    cin>>n>>m;
    vector<int> ans(n,1e9),inp2(m);
    vector<pair<int,int>> inp(m);
    for(int i=0;i<m;i++) cin>>inp[i].first>>inp[i].second>>inp2[i];

    for(int i=0;i<m;i++){
        if(ans[inp[i].first-1]<inp2[i]||ans[inp[i].first-1]==1e9) ans[inp[i].first-1]=inp2[i];
        else if(ans[inp[i].second-1]<inp2[i]||ans[inp[i].second-1]==1e9) ans[inp[i].second-1]=inp2[i];
    }
    for(int i=0;i<n;i++) cout<<ans[i]<<" ";
    

	return(0);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 620 KB Output is correct
7 Correct 1 ms 492 KB Output is correct
8 Correct 10 ms 1644 KB Output is correct
9 Correct 2 ms 492 KB Output is correct
10 Correct 8 ms 1388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 620 KB Output is correct
7 Correct 1 ms 492 KB Output is correct
8 Correct 10 ms 1644 KB Output is correct
9 Correct 2 ms 492 KB Output is correct
10 Correct 8 ms 1388 KB Output is correct
11 Incorrect 1 ms 364 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 748 KB Output is correct
2 Correct 11 ms 1260 KB Output is correct
3 Correct 9 ms 1268 KB Output is correct
4 Correct 5 ms 768 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 620 KB Output is correct
7 Correct 1 ms 492 KB Output is correct
8 Correct 10 ms 1644 KB Output is correct
9 Correct 2 ms 492 KB Output is correct
10 Correct 8 ms 1388 KB Output is correct
11 Incorrect 1 ms 364 KB Output isn't correct
12 Halted 0 ms 0 KB -