Submission #570312

# Submission time Handle Problem Language Result Execution time Memory
570312 2022-05-29T08:05:17 Z 장태환(#8350) Inside information (BOI21_servers) C++17
5 / 100
303 ms 3304 KB
#include <bits/stdc++.h>
//Announcing plan to get the test data is probably not a good idea
using namespace std;
int app[120100];
int main()
{
	int N, K;
	cin >> N >> K;
	int i;
	int c=1;
	for (i = 0; i < N + K - 1; i++)
	{
		char a;
		cin >> a;
		if (a == 'S')
		{
			int a, b;
			cin >> a >> b;
			app[a] = app[b] = c++;
		}
		else if (a == 'Q')
		{
			int a, b;
			cin >> a >> b;
			if (b == 1 && app[a] || a == b || a == 1 && app[b]||app[a]&&app[b]&&app[a]>app[b])
				cout << "yes";
			else
				cout << "no";
			cout << '\n';
		}
		else
		{
			int a;
			cin >> a;
			if (a == 1)
				cout << c << '\n';
			else
				cout << (app[a]?(c- app[a] + 1) :1)<< '\n';
		}
	}
}

Compilation message

servers.cpp: In function 'int main()':
servers.cpp:25:15: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   25 |    if (b == 1 && app[a] || a == b || a == 1 && app[b]||app[a]&&app[b]&&app[a]>app[b])
      |        ~~~~~~~^~~~~~~~~
servers.cpp:25:45: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   25 |    if (b == 1 && app[a] || a == b || a == 1 && app[b]||app[a]&&app[b]&&app[a]>app[b])
      |                                      ~~~~~~~^~~~~~~~~
servers.cpp:25:70: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   25 |    if (b == 1 && app[a] || a == b || a == 1 && app[b]||app[a]&&app[b]&&app[a]>app[b])
      |                                                        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 202 ms 584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 202 ms 584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 217 ms 564 KB Output is correct
2 Correct 303 ms 1096 KB Output is correct
3 Correct 291 ms 1208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 217 ms 564 KB Output is correct
2 Correct 303 ms 1096 KB Output is correct
3 Correct 291 ms 1208 KB Output is correct
4 Correct 241 ms 772 KB Output is correct
5 Correct 301 ms 1536 KB Output is correct
6 Correct 248 ms 3148 KB Output is correct
7 Correct 294 ms 3304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 195 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 195 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 203 ms 712 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 203 ms 712 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 239 ms 628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 239 ms 628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 205 ms 568 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 205 ms 568 KB Output isn't correct
2 Halted 0 ms 0 KB -