| Task: | Binge watching |
| Sender: | aalto25b_011 |
| Submission time: | 2025-09-10 16:56:31 +0300 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | details |
| #2 | WRONG ANSWER | 0.00 s | details |
| #3 | WRONG ANSWER | 0.00 s | details |
| #4 | TIME LIMIT EXCEEDED | -- | details |
| #5 | TIME LIMIT EXCEEDED | -- | details |
| #6 | TIME LIMIT EXCEEDED | -- | details |
| #7 | WRONG ANSWER | 0.00 s | details |
| #8 | WRONG ANSWER | 0.00 s | details |
| #9 | WRONG ANSWER | 0.00 s | details |
Compiler report
input/code.cpp: In function 'int chain_movies(vpi&, vpi)':
input/code.cpp:41:15: warning: variable 'm' set but not used [-Wunused-but-set-variable]
41 | for (auto m : chain) {
| ^
input/code.cpp: In function 'int main()':
input/code.cpp:64:13: warning: variable 'm' set but not used [-Wunused-but-set-variable]
64 | for (auto m : movies) {
| ^Code
// #include <bits/stdc++.h>
#include <ios>
#include <iostream>
#include <vector>
// #include <iostream>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define DO_DBG 0
#if DO_DBG
#define DBG(x) cerr << x << "\n";
#else
#define DBG(x)
#endif
int chain_movies(vpi &all_movies, vpi chain) {
bool nomore = true;
int max = 0;
for (auto m : all_movies) {
if (m.F >= chain.back().S) {
nomore = false;
vpi nc = chain;
nc.push_back(m);
int chain_len = chain_movies(all_movies, nc);
if (chain_len > max) {
max = chain_len;
DBG("New record chain length: " << max)
}
}
}
if (nomore) {
DBG("NEW CHAIN:")
for (auto m : chain) {
DBG("start: " << m.F << ", end: " << m.S)
}
DBG("size: " << chain.size() << "\n")
return chain.size();
} else {
return max;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
DBG("INIT")
int n;
cin >> n;
vpi movies;
for (int i = 0; i < n; i++) {
int start, end;
cin >> start >> end;
movies.PB(MP(start, end));
}
for (auto m : movies) {
DBG("start: " << m.F << ", end: " << m.S)
}
DBG("")
for (auto m : movies) {
chain_movies(movies, vpi{m});
}
}
Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 10 6 7 4 5 8 9 2 3 ... |
| correct output |
|---|
| 10 |
| user output |
|---|
| (empty) |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 10 1 1000 1 1000 1 1000 1 1000 ... |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 10 404 882 690 974 201 255 800 933 ... |
| correct output |
|---|
| 4 |
| user output |
|---|
| (empty) |
Test 4
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 177494 177495 157029 157030 6030 6031 15209 15210 ... |
| correct output |
|---|
| 200000 |
| user output |
|---|
| (empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 ... |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 82334756 323555178 958182284 981100325 649818003 678160906 801994655 889397498 ... |
| correct output |
|---|
| 725 |
| user output |
|---|
| (empty) |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 3 1 1000 2 3 5 6 |
| correct output |
|---|
| 2 |
| user output |
|---|
| (empty) |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 3 3 4 5 6 7 8 |
| correct output |
|---|
| 3 |
| user output |
|---|
| (empty) |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 2 1 2 3 4 |
| correct output |
|---|
| 2 |
| user output |
|---|
| (empty) |
