QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#149165#4564. Digital Circuitjuanda_o_182Compile Error//C++23613b2023-08-24 04:36:092023-08-24 04:36:11

Judging History

你现在查看的是最新测评结果

  • [2023-08-24 04:36:11]
  • 评测
  • [2023-08-24 04:36:09]
  • 提交

answer

#include "circuit.h"
#include <bits/stdc++.h>

using namespace std;

#define pb push_back

int n,m,on;
vector<int>p;
vector<int>a;


void init(int N, int M, vector<int> P, vector<int> A) {
  N=n;
  M=m;
  for(int i=0;i<int(P.size());i++){
    p.pb(P[i]);
  }
  for(int i=0;i<int(A.size());i++){
    a.pb(A[i]);
    if(A[i]==1){
      on+=1;
    }
  }
}

int count_ways(int L, int R) {
  L-=1;
  R-=1;
  if (a[L]==0){
    a[L]=1;
    on+=1;
  }else{
    a[L]=0;
    on-=1
  }
  if (a[R]==0){
    a[R]=1;
    on+=1;
  }else{
    a[R]=0;
    on-=1
  }


  return on;

}

Details

answer.code: In function ‘int count_ways(int, int)’:
answer.code:35:10: error: expected ‘;’ before ‘}’ token
   35 |     on-=1
      |          ^
      |          ;
   36 |   }
      |   ~       
answer.code:42:10: error: expected ‘;’ before ‘}’ token
   42 |     on-=1
      |          ^
      |          ;
   43 |   }
      |   ~