Submission #833872

#TimeUsernameProblemLanguageResultExecution timeMemory
833872LiudasArcade (NOI20_arcade)C++17
18 / 100
2 ms596 KiB
#include <iostream> #include <vector> #include <set> #include <algorithm> using namespace std; struct button{ int A, T; bool operator<(const button &x)const{ return T < x.T; } }; int best = 3; set<vector<button>> seen; void BFS(int B, vector<button> &arr, vector<button> used){ if(B == arr.size()){ best = used.size(); return; } if(used.size() >= best){ return; } for(button &i : used){ if(abs(arr[B].A-i.A) <= arr[B].T-i.T){ button t = i; i = arr[B]; if(seen.find(used)!=seen.end()){i=t; continue;} seen.insert(used); BFS(B+1, arr, used); i = t; } if(used.size() >= best)return; } used.push_back(arr[B]); if(seen.find(used)!=seen.end())return; seen.insert(used); 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:15:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<button>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     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...