Submission #833858

#TimeUsernameProblemLanguageResultExecution timeMemory
833858LiudasArcade (NOI20_arcade)C++17
7 / 100
1084 ms300 KiB
#include <iostream> #include <vector> #include <set> #include <algorithm> using namespace std; struct button{ int A, T; bool operator<(button &x){ return T < x.T; } }; int best = 3; void BFS(int B, vector<button> &arr, vector<button> used){ if(B == arr.size()){ best = used.size(); return; } //cout << B << " " << arr.size() << " " << used.size() << endl; if(used.size() >= best){ return; } for(button &i : used){ //cout << B << " " << arr.size() << endl; if(abs(arr[B].A-i.A) <= arr[B].T-i.T){ button t = i; i = arr[B]; BFS(B+1, arr, used); i = t; } //cout << B << " " << arr.size() << endl; if(used.size() >= best)return; } //cout << B << " " << arr.size() << endl; used.push_back(arr[B]); BFS(B+1, arr, used); } int main(){ int N, M; cin >> N >> M; vector<button> arr(M); for(int i = 0; i < M; i ++){ cin >> arr[i].T; } for(int j = 0; j < M; j ++){ cin >> arr[j].A; } sort(arr.begin(), arr.end()); vector<button> used; used.push_back(arr[0]); BFS(0, arr, used); cout << best << endl; return 0; }

Compilation message (stderr)

Arcade.cpp: In function 'void BFS(int, std::vector<button>&, std::vector<button>)':
Arcade.cpp:14:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<button>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     if(B == arr.size()){
      |        ~~^~~~~~~~~~~~~
Arcade.cpp:19:20: warning: comparison of integer expressions of different signedness: 'std::vector<button>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |     if(used.size() >= best){
      |        ~~~~~~~~~~~~^~~~~~~
Arcade.cpp:31:24: warning: comparison of integer expressions of different signedness: 'std::vector<button>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   31 |         if(used.size() >= best)return;
      |            ~~~~~~~~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...