Submission #774360

#TimeUsernameProblemLanguageResultExecution timeMemory
774360AmirElarbiKoala Game (APIO17_koala)C++14
4 / 100
3 ms208 KiB
#include <bits/stdc++.h> #define ve vector #define vi vector<int> #define vii vector<ii> //#define ii pair<int,int> #define fi first #define se second #define ll long long #define INF 1e18+7 #define pb push_back #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; const int MOD = 1e9+7; const int nax = 2e5+5; const int kax = 60+5; void readio(){ #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } #include "koala.h" int minValue(int n, int w) { int s[n], r[n]; memset(s, 0, sizeof s); memset(r, 0, sizeof r); s[0] = 1; playRound(s, r); int ans = 0; for (int i = 1; i < n; ++i) { if(r[i] == 0) ans = i; } return ans; } int maxValue(int n, int w) { int s[n], r[n]; memset(r, 0, sizeof r); for (int i = 0; i < n; ++i) { s[i] = 1; } playRound(s, r); vi best; for (int i = 0; i < n; ++i) if(r[i] == 2) best.pb(i); memset(r, 0, sizeof r); for(auto x : best) s[x] = 2; playRound(s, r); best.clear(); for (int i = 0; i < n; ++i) if(r[i] == 3) best.pb(i); memset(r, 0, sizeof r); for(auto x : best) s[x] = 6; playRound(s, r); best.clear(); for (int i = 0; i < n; ++i) if(r[i] == 7) best.pb(i); assert(best.size() > 1); for(auto x : best) s[x] = 12; playRound(s, r); for (int i = 0; i < n; ++i) if(r[i] == 13) return i; } int greaterValue(int N, int W) { // TODO: Implement Subtask 3 solution here. // You may leave this function unmodified if you are not attempting this // subtask. return 0; } void allValues(int N, int W, int *P) { if (W == 2*N) { // TODO: Implement Subtask 4 solution here. // You may leave this block unmodified if you are not attempting this // subtask. } else { // TODO: Implement Subtask 5 solution here. // You may leave this block unmodified if you are not attempting this // subtask. } }

Compilation message (stderr)

koala.cpp: In function 'void readio()':
koala.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
koala.cpp:24:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:51:8: warning: control reaches end of non-void function [-Wreturn-type]
   51 |     vi best;
      |        ^~~~
#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...