제출 #557559

#제출 시각아이디문제언어결과실행 시간메모리
557559MounirInside information (BOI21_servers)C++14
컴파일 에러
0 ms0 KiB
#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; }

컴파일 시 표준 에러 (stderr) 메시지

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;
      |                                      ^~~~