#include <bits/stdc++.h>
/*
How
*/
int main(){
int n,m;
std::cin>>n>>m;
if(n>20||m>20)return 110;
std::vector<std::pair<int,int>> nums;
for(int i=0;i<m;i++){
int a,b,c;
std::cin>>a>>b>>c;
a--,b--;
if(a>b)std::swap(a,b);
nums.push_back({a,b});
}
int mnmx=20;
for(int i=0;i<(1<<m);i++){
int mx=0;
for(int j=0;j<n;j++){
int nm=0;
for(int k=0;k<m;k++){
if((j>=nums[k].first&&j<nums[k].second)^((i>>k)&1)){
nm++;
}
}
mx=std::max(mx,nm);
}
mnmx=std::min(mnmx,mx);
}
std::cout<<mnmx<<'\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
461 ms |
592 KB |
Output is correct |
2 |
Correct |
437 ms |
404 KB |
Output is correct |
3 |
Correct |
466 ms |
344 KB |
Output is correct |
4 |
Correct |
449 ms |
348 KB |
Output is correct |
5 |
Correct |
438 ms |
348 KB |
Output is correct |
6 |
Correct |
457 ms |
344 KB |
Output is correct |
7 |
Correct |
444 ms |
408 KB |
Output is correct |
8 |
Correct |
451 ms |
348 KB |
Output is correct |
9 |
Correct |
444 ms |
344 KB |
Output is correct |
10 |
Correct |
445 ms |
408 KB |
Output is correct |
11 |
Correct |
474 ms |
408 KB |
Output is correct |
12 |
Correct |
441 ms |
348 KB |
Output is correct |
13 |
Correct |
464 ms |
412 KB |
Output is correct |
14 |
Correct |
474 ms |
348 KB |
Output is correct |
15 |
Correct |
436 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
461 ms |
592 KB |
Output is correct |
2 |
Correct |
437 ms |
404 KB |
Output is correct |
3 |
Correct |
466 ms |
344 KB |
Output is correct |
4 |
Correct |
449 ms |
348 KB |
Output is correct |
5 |
Correct |
438 ms |
348 KB |
Output is correct |
6 |
Correct |
457 ms |
344 KB |
Output is correct |
7 |
Correct |
444 ms |
408 KB |
Output is correct |
8 |
Correct |
451 ms |
348 KB |
Output is correct |
9 |
Correct |
444 ms |
344 KB |
Output is correct |
10 |
Correct |
445 ms |
408 KB |
Output is correct |
11 |
Correct |
474 ms |
408 KB |
Output is correct |
12 |
Correct |
441 ms |
348 KB |
Output is correct |
13 |
Correct |
464 ms |
412 KB |
Output is correct |
14 |
Correct |
474 ms |
348 KB |
Output is correct |
15 |
Correct |
436 ms |
344 KB |
Output is correct |
16 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
461 ms |
592 KB |
Output is correct |
2 |
Correct |
437 ms |
404 KB |
Output is correct |
3 |
Correct |
466 ms |
344 KB |
Output is correct |
4 |
Correct |
449 ms |
348 KB |
Output is correct |
5 |
Correct |
438 ms |
348 KB |
Output is correct |
6 |
Correct |
457 ms |
344 KB |
Output is correct |
7 |
Correct |
444 ms |
408 KB |
Output is correct |
8 |
Correct |
451 ms |
348 KB |
Output is correct |
9 |
Correct |
444 ms |
344 KB |
Output is correct |
10 |
Correct |
445 ms |
408 KB |
Output is correct |
11 |
Correct |
474 ms |
408 KB |
Output is correct |
12 |
Correct |
441 ms |
348 KB |
Output is correct |
13 |
Correct |
464 ms |
412 KB |
Output is correct |
14 |
Correct |
474 ms |
348 KB |
Output is correct |
15 |
Correct |
436 ms |
344 KB |
Output is correct |
16 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
461 ms |
592 KB |
Output is correct |
2 |
Correct |
437 ms |
404 KB |
Output is correct |
3 |
Correct |
466 ms |
344 KB |
Output is correct |
4 |
Correct |
449 ms |
348 KB |
Output is correct |
5 |
Correct |
438 ms |
348 KB |
Output is correct |
6 |
Correct |
457 ms |
344 KB |
Output is correct |
7 |
Correct |
444 ms |
408 KB |
Output is correct |
8 |
Correct |
451 ms |
348 KB |
Output is correct |
9 |
Correct |
444 ms |
344 KB |
Output is correct |
10 |
Correct |
445 ms |
408 KB |
Output is correct |
11 |
Correct |
474 ms |
408 KB |
Output is correct |
12 |
Correct |
441 ms |
348 KB |
Output is correct |
13 |
Correct |
464 ms |
412 KB |
Output is correct |
14 |
Correct |
474 ms |
348 KB |
Output is correct |
15 |
Correct |
436 ms |
344 KB |
Output is correct |
16 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
461 ms |
592 KB |
Output is correct |
2 |
Correct |
437 ms |
404 KB |
Output is correct |
3 |
Correct |
466 ms |
344 KB |
Output is correct |
4 |
Correct |
449 ms |
348 KB |
Output is correct |
5 |
Correct |
438 ms |
348 KB |
Output is correct |
6 |
Correct |
457 ms |
344 KB |
Output is correct |
7 |
Correct |
444 ms |
408 KB |
Output is correct |
8 |
Correct |
451 ms |
348 KB |
Output is correct |
9 |
Correct |
444 ms |
344 KB |
Output is correct |
10 |
Correct |
445 ms |
408 KB |
Output is correct |
11 |
Correct |
474 ms |
408 KB |
Output is correct |
12 |
Correct |
441 ms |
348 KB |
Output is correct |
13 |
Correct |
464 ms |
412 KB |
Output is correct |
14 |
Correct |
474 ms |
348 KB |
Output is correct |
15 |
Correct |
436 ms |
344 KB |
Output is correct |
16 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
17 |
Halted |
0 ms |
0 KB |
- |