답안 #557559

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
557559 2022-05-05T13:07:56 Z Mounir Inside information (BOI21_servers) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define print(x) cout << #x << " est " << x << endl;
#define x first
#define y second
#define int long long
using namespace std;
 
const int N = 2e5;
int date[N];
 
signed main(){  
      int nServs, nReqs; cin >> nServs >> nReqs;
      int ip = 1;
      nReqs += nServs - 1;
      while (nReqs--){
            char t; cin >> t;
            if (t == 'S'){
                  int a, b; cin >> a >> b;
                  date[max(a, b)] = ip++;
            }
            else if (t == 'Q'){
                  int a, d; cin >> a >> d;
                  if (date[d] <= date[a] && (date[a] != 0 && date[d] != 0)) cout << "yes" << endl;
                  else if (d == 1 && date[a] != 0) cout << "yes" << endl;
                  else if (a == & && data[d] != 0) cout << "yes" << endl;
                  else cout << "no" << endl;
            }
            else {
                  int d; cin >> d;
                  if (date[d] != 0)
                        cout << ip - date[d] + 1 << endl;
                  else if (d == 1)
                        cout << ip << endl;
                  else
                        cout << 1 << endl;
            }
      }
      return 0;   
}

Compilation message

servers.cpp: In function 'int main()':
servers.cpp:31:35: error: lvalue required as unary '&' operand
   31 |                   else if (a == & && data[d] != 0) cout << "yes" << endl;
      |                                   ^~~~~~~
servers.cpp:31:42: error: expected ')' before '[' token
   31 |                   else if (a == & && data[d] != 0) cout << "yes" << endl;
      |                           ~              ^
      |                                          )
servers.cpp:31:38: error: label 'data' used but not defined
   31 |                   else if (a == & && data[d] != 0) cout << "yes" << endl;
      |                                      ^~~~