Submission #899598

# Submission time Handle Problem Language Result Execution time Memory
899598 2024-01-06T14:03:17 Z pcc Lost Array (NOI19_lostarray) C++14
100 / 100
22 ms 3940 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


const ll inf = 1e9;
const ll mxn = 1e5+10;
pair<pii,int> ask[mxn];
int ans[mxn];

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,m;
	fill(ans,ans+mxn,1);
	cin>>n>>m;
	for(int i = 0;i<m;i++){
		cin>>ask[i].fs.fs>>ask[i].fs.sc>>ask[i].sc;
		ans[ask[i].fs.fs] = max(ans[ask[i].fs.fs],ask[i].sc);
		ans[ask[i].fs.sc] = max(ans[ask[i].fs.sc],ask[i].sc);
	}
	for(int i =0;i<m;i++){
		assert(min(ans[ask[i].fs.fs],ans[ask[i].fs.sc]) == ask[i].sc);
	}
	for(int i = 1;i<=n;i++)cout<<ans[i]<<' ';return 0;
}

Compilation message

lostarray.cpp: In function 'int main()':
lostarray.cpp:30:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   30 |  for(int i = 1;i<=n;i++)cout<<ans[i]<<' ';return 0;
      |  ^~~
lostarray.cpp:30:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   30 |  for(int i = 1;i<=n;i++)cout<<ans[i]<<' ';return 0;
      |                                           ^~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 1 ms 860 KB Output is correct
8 Correct 5 ms 860 KB Output is correct
9 Correct 1 ms 860 KB Output is correct
10 Correct 5 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 1 ms 860 KB Output is correct
8 Correct 5 ms 860 KB Output is correct
9 Correct 1 ms 860 KB Output is correct
10 Correct 5 ms 860 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 1 ms 860 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 1 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1116 KB Output is correct
2 Correct 7 ms 1772 KB Output is correct
3 Correct 5 ms 1372 KB Output is correct
4 Correct 4 ms 1116 KB Output is correct
5 Correct 1 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 1 ms 860 KB Output is correct
8 Correct 5 ms 860 KB Output is correct
9 Correct 1 ms 860 KB Output is correct
10 Correct 5 ms 860 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 1 ms 860 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 1 ms 860 KB Output is correct
16 Correct 3 ms 1116 KB Output is correct
17 Correct 7 ms 1772 KB Output is correct
18 Correct 5 ms 1372 KB Output is correct
19 Correct 4 ms 1116 KB Output is correct
20 Correct 1 ms 860 KB Output is correct
21 Correct 10 ms 2256 KB Output is correct
22 Correct 11 ms 2500 KB Output is correct
23 Correct 14 ms 2908 KB Output is correct
24 Correct 14 ms 2908 KB Output is correct
25 Correct 22 ms 3940 KB Output is correct