답안 #696289

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
696289 2023-02-06T07:15:58 Z Dan4Life Inside information (BOI21_servers) C++17
0 / 100
46 ms 1152 KB
#include <bits/stdc++.h>
using namespace std;
const int mxN = (int)120010;

int n, k, pos[mxN];
int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> k; int sz = 1;
    for(int _ = 0; _ < n+k-1; _++){
        char t; int x, y;
        cin >> t >> x;
        if(t=='S'){
            cin >> y;
            if(x>y)swap(x,y);
            pos[y]=sz++;
        }
        else if(t=='Q'){
            cin >> y;
            if(x==1) cout << (pos[y]?"yes":"no");
            else if(y==1) cout << (pos[x]?"yes":"no");
            else cout << (pos[x]>pos[y] and pos[x] and pos[y]?"yes":"no");

        }
        else{
            cout << pos[x]?sz-pos[x]:0;
        }
        if(t!='S') cout << "\n";
    }
}

Compilation message

servers.cpp: In function 'int32_t main()':
servers.cpp:26:30: warning: second operand of conditional expression has no effect [-Wunused-value]
   26 |             cout << pos[x]?sz-pos[x]:0;
      |                            ~~^~~~~~~
servers.cpp:26:39: warning: third operand of conditional expression has no effect [-Wunused-value]
   26 |             cout << pos[x]?sz-pos[x]:0;
      |                                       ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 696 KB Output is correct
2 Incorrect 46 ms 1152 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 696 KB Output is correct
2 Incorrect 46 ms 1152 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 660 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 660 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 612 KB Output isn't correct
2 Halted 0 ms 0 KB -