QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#687414#6470. Looping PlaylistPetroTarnavskyi#WA 0ms3624kbC++231.1kb2024-10-29 18:53:262024-10-29 18:53:30

Judging History

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

  • [2024-10-29 18:53:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3624kb
  • [2024-10-29 18:53:26]
  • 提交

answer

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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef double db;


VI shifts = {0, 2, 4, 5, 7, 9, 11, 12};
vector<string> notes = {"Do", "Do#", "Re", "Re#", "Mi", "Fa", "Fa#", "Sol", "Sol#", "La", "La#", "Si"};


int basicNote[12];



int main()
{
	ios::sync_with_stdio(0); 
	cin.tie(0);
	
	FOR(i, 0, 12)
	{
		for(int sh : shifts)
			basicNote[(i + sh) % 12] |= 1 << i;
	}
	
	int n;
	cin >> n;
	int mask = 0;
	int ans = 0;
	
	FOR(i, 0, n)
	{
		string s;
		cin >> s;
		int id = -1;
		FOR(j, 0, 12)
			if(notes[j] == s)
				id = j;
		assert(id != -1);
		
		mask = mask & basicNote[id];
		if(mask == 0)
		{
			ans++;
			mask = basicNote[id];
		}		
	}
	cout << ans << "\n";
	
	
	
	
	




	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3624kb

input:

8
La
Si
Do
Si
La
Sol
Fa
Mi


output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

9
Mi
Si
Sol
Do
Re
Fa#
Fa
Do
La


output:

2

result:

ok single line: '2'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3584kb

input:

16
Fa
Mi
Sol
Re
La
Do
Si
Fa#
Fa
Mi
Sol
Re
La
Do
Si
La#

output:

4

result:

wrong answer 1st lines differ - expected: '3', found: '4'