QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#657081 | #5301. Modulo Ruins the Legend | ShiyuKirara | WA | 0ms | 3824kb | C++20 | 3.0kb | 2024-10-19 14:10:14 | 2024-10-19 14:10:15 |
Judging History
answer
#include<bits/stdc++.h>
#define inf 1e18
using namespace std;
using ll = long long;
#define int long long
#define PII pair<int,int>
#define all(a) a.begin()+1, a.begin()+1+n
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
#define ios ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
const ll N=2e5+10,mod=998244353,INF=1e9+10;
void solve(){
int n,m;
cin>>n>>m;
vector<ll> a(n+10);
int sum=0;
for (int i=1;i<=n;i++){
cin>>a[i];
sum+=a[i];
}
int mn=sum%m;
int aa=0,bb=0;
int dd=n*(n+1)/2;
for (int i=1;i<=1000;i++){
if((sum+n*i)%m<mn)
mn=(sum+n*i)%m,aa=i,bb=0;
if((sum+dd*i)%m<mn)
mn=(sum+dd*i)%m,aa=0,bb=i;
}
cout<<mn<<endl<<aa<<" "<<bb;
}
signed main(){
ios;
int T=1;
// cin>>T;
while (T--){
solve();
}
return 0;
}
//Shift+Alt+F格式化
//⠀⠀⠀⢛⢆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⠀⠀⠂⣠⡀⢀⣀⠀⠠⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⡄⠀⠀⠀
//⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⢀⢤⢤⡘⠀⠀⠀⠀⠔⠋⠘⢆⠀⠙⢦⠀⠑⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠣⠀⠀⠀⠀⠠⢢⠃⠀⠈⠀⠀⠀⠀⠀⠀⠉⢿⣷⡀⠀⠑⡄⠀⠈⢢⠀⠀⢀⡀⠀⢰⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠰⠡⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⣧⠀⠀⠙⠀⠀⠀⣇⠀⠀⠀⠀⠚⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠰⣇⠀⠰⠁⠀⠀⠀⠀⣴⠀⠀⠀⠀⠰⢧⠀⠀⠘⣿⡄⠀⠀⠀⠀⠰⡌⣱⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠤⠀⠀⠉⠀⡁⠀⠀⢠⠀⠀⢎⡆⠀⠀⠀⠐⡤⠵⢖⢲⣿⣇⠀⠀⠰⣦⣦⡈⢫⣃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⢠⡀⠀⠀⢀⡅⣤⠀⣼⠒⠞⣀⡣⣤⣤⣤⣴⢷⣤⣤⠷⣮⢿⠀⠀⠀⠀⠈⠹⡰⠳⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠃⣿⣀⣿⡾⢷⡖⢶⡄⠉⠁⠈⠀⢏⠁⠉⠹⢘⠀⠀⠀⠀⠀⠀⣼⠷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡏⣿⡄⠘⠧⡁⠀⠇⠀⠀⠀⠀⠈⠀⠀⠀⠈⠀⠀⣾⣦⣶⣤⣿⣦⠲⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣠⢁⢹⣇⠀⠀⠀⠀ ~~~ ⠈⣠⠀⠀⣿⣿⣿⣿⡿⣿⣧⡘⢄⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⣾⢸⣿⣦⣀⠂⠀⠀⠀⠀⠀⠀⠀⠀⠔⠊⢹⠀⠀⡹⠛⠟⠁⠠⣇⠛⠿⢦⡑⢄⠀⠀⠄⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⢠⣈⣸⡟⠁⠈⡹⠛⠉⠉⠉⢒⡀⢔⠁⠀⠀⢸⣿⣿⣷⠀⠀⢀⡠⡚⢦⣒⣄⠈⠀⠑⠤⡀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠐⠁⢀⡠⢺⣿⣿⡟⠀⠀⠈⠢⠇⠀⡀⢺⡶⣾⣕⣄⡀⣼⣿⣿⡿⠀⠉⠁⠀⠘⡄⠱⢿⣿⣄⡀⠑⠌⠢⡀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⢀⠴⣋⢠⣾⣿⣿⡁⠀⠀⠀⠀⠀⡸⢁⣿⠇⣿⢻⣷⡍⢾⣿⣿⣿⡄⠀⠀⠀⠀⣸⢧⠈⢻⣿⣿⣦⣀⣀⢠⠀⠀⠀⠀
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3824kb
input:
6 24 1 1 4 5 1 4
output:
1 0 5
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
7 29 1 9 1 9 8 1 0
output:
0 0 0
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
1 1 0
output:
0 0 0
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3560kb
input:
1 1000000000 963837005
output:
963837005 0 0
result:
wrong answer Participant answer greater than judge