QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#88087#2301. Jet SetBitrollWA 1ms3400kbC++171.3kb2023-03-15 09:48:512023-03-15 09:48:52

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-15 09:48:52]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3400kb
  • [2023-03-15 09:48:51]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

// debug util
#ifdef DEBUG
    #define deb(x) cerr << #x << " = " << x << endl
#else
    #define deb(x)
#endif

// useful
#define ll long long
#define umap unordered_map
bool multi = false;

void solve(){
	int n;
	cin >> n;
	
	int firstVal;
	bool vis[720] = {};
	
	int i, j, bk;
	
	// get input
	for (int h = 0; h <= n; h++){

		if (h != n)
			cin >> j >> j;
		else
			j = firstVal;

		j += 360;
		j %= 360;
		
		if (h == 0){
			firstVal = j;
			i = j;
			continue;
		}
		
		if ((abs(j-i) != 180)){
			// make sure i is less than j
			if (((i) > (j))){
				bk = i;
				i = j;
				j = bk;
			}
			
			// get shortest path
			if (((j - i) > (360 - j + i))){
				bk = i;
				i = j;
				j = bk;
			}
		}


		deb(i);
		deb(j);

		int f = i;
		while (true){
			int s = f*2;
			vis[s] = true;
			
			//cout << (s) << " ";
			if (f != j){
				vis[s+1] = true;
				//cout << s+1 << " ";
			}
			else break;

			f++;
			f %= 360;
		}

		//cout << endl;
		i = j;
	}
	
	// check everything is visited
	
	for (int i = 0; i < 720; i++){
		//cout << vis[i] << " ";
		if (!vis[i]){
			cout << "no" << endl;
			return;
		}
	}
	cout << "yes" << endl;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    if(multi)cin>>t;
    while(t--)solve();
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3400kb

input:

6
0 -180
0 60
0 -60
0 -179
0 -60
0 60

output:

yes

result:

wrong answer Wrong answer: expected 'no', got 'yes'.