QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#687417 | #6470. Looping Playlist | PetroTarnavskyi# | WA | 1ms | 3840kb | C++23 | 1.2kb | 2024-10-29 18:54:24 | 2024-10-29 18:54:26 |
Judging History
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)
{
if(notes[i].back() == '#')
continue;
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;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3840kb
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: 3620kb
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: 1ms
memory: 3608kb
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'