四大文化赛道完整展开
03-execution/run-002/source-snapshot/main.cpp
main.cpp
站内文件视图直接读取仓库内容,Markdown 使用文档排版渲染,其余文本文件保持原始排版,方便校对训练证据链。
文件类型.cpp
10-cases/s4-jh-05-stage-schedule/03-execution/run-002/source-snapshot/main.cpp
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
if (!(cin >> n)) {
return 0;
}
vector<tuple<int, int, int, string>> shows;
for (int order = 0; order < n; ++order) {
string name;
int start, end;
cin >> name >> start >> end;
shows.push_back({end, start, order, name});
}
sort(shows.begin(), shows.end());
vector<string> selected;
int last_end = -1;
for (const auto& show : shows) {
int end = get<0>(show);
int start = get<1>(show);
const string& name = get<3>(show);
if (start >= last_end) {
selected.push_back(name);
last_end = end;
}
}
cout << "selected=" << selected.size() << "\n";
cout << "shows=";
if (selected.empty()) {
cout << "NONE";
} else {
for (size_t i = 0; i < selected.size(); ++i) {
if (i) {
cout << ',';
}
cout << selected[i];
}
}
cout << "\n";
return 0;
}