Submission #1081462

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10814622024-08-30 05:15:23kes0716Archery (IOI09_archery)C++17
65 / 100
293 ms14632 KiB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200009;
int n, r, crit;
int a[2*MAXN];
struct State{
int pl, ze, mi;
State operator+(const State &s) const{
return (State){pl+s.pl, ze+s.ze, mi+s.mi};
}
} init[MAXN];
int simulate1(void){
vector<State> pot(5*n);
State pq = {0, 0, 0};
int i, j;
for(i=0; i<n; i++){
pot[i] = init[i];
}
for(i=n; i<5*n; i++)
pot[i] = {0, 0, 0};
int cnt = 0, last = -1;
int lwin = (init[0].pl ? 1 : (init[0].ze ? 0 : -1));
for(i=0; i<4*n; i++){
pq = pq + pot[i];
int oppb;
//printf("i=%d pq= +%d 0%d -%d\n", i, pq.pl, pq.ze, pq.mi);
if(pq.pl >= 2){
oppb = 1;
pot[i+n].pl++;
pq.pl--;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

archery.cpp: In function 'int simulate1()':
archery.cpp:15:9: warning: unused variable 'j' [-Wunused-variable]
   15 |  int i, j;
      |         ^
archery.cpp: In function 'int main()':
archery.cpp:127:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  127 |  scanf("%d %d", &n, &r);
      |  ~~~~~^~~~~~~~~~~~~~~~~
archery.cpp:129:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  129 |  scanf("%d", &crit);
      |  ~~~~~^~~~~~~~~~~~~
archery.cpp:131:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  131 |   scanf("%d", &a[i]);
      |   ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...