QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#399699 | #2820. 令人难以忘记的题目名称 | ucup-team1251 | Compile Error | / | / | C++17 | 689b | 2024-04-26 17:05:16 | 2024-04-26 17:05:18 |
Judging History
This is the latest submission verdict.
- [2024-04-26 17:05:18]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-04-26 17:05:16]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
// typedef long long ll;
const int N = 1e6 + 7;
int ai[N];
int bi[N];
queue<int>q;
void solve()
{
int n,m;
cin >> n >> m;
int sum = 0;
for(int i = 1; i <= n; i++) {
cin >> ai[i];
bi[ai[i] % m]++;
if(bi[ai[i] % m] == 2) sum++;
}
if(sum == 1) {
if(ai[i] % m == 0) cout << "0";
else cout << "1";
}else if(sum == 2) {
for(int i = 2; i <= n; i++) {
if(ai[i] % m == ai[i - 1] % m) {
cout << "-1\n";
return;
}
}
cout << "2\n";
}else cout << "-1";
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tt;
tt = 1;
// cin >> tt;
while (tt--)
{
solve();
}
}
詳細信息
answer.code: In function ‘void solve()’: answer.code:22:23: error: ‘i’ was not declared in this scope 22 | if(ai[i] % m == 0) cout << "0"; | ^