Submission #60734735


Source Code Expand

Copy
/*
Start:
End:
Time used:
……
…………
DON'T GET STUCK ON ONE APPROACH!!!
*/
#include <bits/stdc++.h>//
#define re register//
#define rep(i,a,b) for (re int i = (a);i <= (b); ++i)
#define debug(x) cout << #x << '=',print(x),putchar(' ')
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define pi pair<int,int>
#define mp(a,b) make_pair(a,b)
typedef long long ll;
using namespace std;//
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/*
Start: 
End: 
Time used: 
「責任を負う人の話は、あなたと話したことがありますよね」 
「当時の私はまだわからないけど……今は理解できるようになった」 
「大人としての責務。そして、その延長線上にある、あなたの選択」 
「それに代表されるアイデアもあります」 
「だから、先生」 
「信じられる大人のあなたなら、この歪んだ変形の終点とは、違う結果……そこにつながる選択肢……きっとあなたは見つけることができます」
DON'T GET STUCK ON ONE APPROACH!!!
*/
#include <bits/stdc++.h>//喵内~
#define re register//喵内~
#define rep(i,a,b) for (re int i = (a);i <= (b); ++i)
#define debug(x) cout << #x << '=',print(x),putchar(' ')
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define pi pair<int,int>
#define mp(a,b) make_pair(a,b)
typedef long long ll;
using namespace std;//喵内~
inline ll read(){
    ll s = 0,f = 1;char c = getchar();
    while (!isdigit(c)){if (c == '-')f = -1;c = getchar();}
    while (isdigit(c)){s = (s<<3) + (s<<1) + (c ^ 48);c = getchar();}
    return s * f;
}//喵内~
void print(__int128 x){if (x < 0) {putchar('-'),print(-x);return ;}if (x >= 10) print(x / 10);putchar(x % 10 + 48);}//喵内~
//const int Mod = 1e9 + 7;//喵内~要填数字哟~
const int Mod = 998244353;//喵内~要填数字哟~
const ll INF = 0x3f3f3f3f;
const int N = 4e6 + 5;//喵内~要填数字哟~
ll qpow(ll x,ll y){
   ll res = 1;
    for (;y;y >>= 1,x = x * x % Mod) if (y & 1) res = res * x % Mod;
    return res;
}
int n,a[N];
ll sum[N],s,s1;
map<ll,int> mp;
signed main(){
    n = read(); s = read();
    for (int i = 1;i <= n;++i) a[i] = read(),a[i + n] = a[i];
    for (int i = 1;i <= 2 * n;++i) sum[i] = sum[i - 1] + a[i];
    s = s % sum[n];
    mp[0] = 1;
    for (int i = 1;i <= 2 * n;++i){
        //sum[i] - val = s;(mod)
        if (mp.find((sum[i] % sum[n] - s + sum[n]) % sum[n]) != mp.end()) {puts("Yes"); return 0;}
        mp[sum[i] % sum[n]] = 1;
    } puts("No");
    return 0;
}//喵内~
/*
What's wrong with my code?
1. 小数据?特殊数据?如 n = 1?
2. 最小值,最大值取多少?是否会溢出?
3. 初始值有没有赋值?有没有建树?
4. 数组大小?是否越界?
5. 思考暴力的时候,考虑是否可能是多个连续段?或者是个数不确定无法暴力?
6. 进行详细的分类讨论?
7. 选择的区间是否可以为空?

Trick:
1. 连通 通常带有特殊性质
2. LIS 有另一种求法
3. Brovuka?

About implementation skills:
1. 全局变量多用长变量名,而局部变量,临时变量,和函数传递的参数使用短变量名。
2. 大模拟尽量遵循:怎么方便怎么写。
3. 对于一些数据很小的需要维护的量并且需要大量讨论时,可以考虑把数组拆掉换成变量。
4. 写成多个函数。
*/

Submission Info

Submission Time
Task D - Repeated Sequence
User FlamingBlade
Language C++ 20 (gcc 12.2)
Score 400
Code Size 3020 Byte
Status AC
Exec Time 111 ms
Memory 20860 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 54
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt, 01_random_34.txt, 01_random_35.txt, 01_random_36.txt, 01_random_37.txt, 01_random_38.txt, 01_random_39.txt, 01_random_40.txt, 01_random_41.txt, 01_random_42.txt, 01_random_43.txt, 01_random_44.txt, 01_random_45.txt, 02_handmade_46.txt, 02_handmade_47.txt, 02_handmade_48.txt, 02_handmade_49.txt, 02_handmade_50.txt, 02_handmade_51.txt, 02_handmade_52.txt, 02_handmade_53.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3520 KB
00_sample_01.txt AC 1 ms 3464 KB
00_sample_02.txt AC 1 ms 3612 KB
00_sample_03.txt AC 1 ms 3564 KB
01_random_04.txt AC 31 ms 13796 KB
01_random_05.txt AC 111 ms 20592 KB
01_random_06.txt AC 49 ms 17576 KB
01_random_07.txt AC 110 ms 20712 KB
01_random_08.txt AC 68 ms 20856 KB
01_random_09.txt AC 109 ms 20664 KB
01_random_10.txt AC 108 ms 20664 KB
01_random_11.txt AC 107 ms 20664 KB
01_random_12.txt AC 40 ms 15808 KB
01_random_13.txt AC 32 ms 14288 KB
01_random_14.txt AC 38 ms 15192 KB
01_random_15.txt AC 111 ms 20708 KB
01_random_16.txt AC 62 ms 20496 KB
01_random_17.txt AC 107 ms 20700 KB
01_random_18.txt AC 64 ms 20324 KB
01_random_19.txt AC 105 ms 20708 KB
01_random_20.txt AC 108 ms 20860 KB
01_random_21.txt AC 73 ms 20856 KB
01_random_22.txt AC 109 ms 20856 KB
01_random_23.txt AC 105 ms 20672 KB
01_random_24.txt AC 108 ms 20668 KB
01_random_25.txt AC 48 ms 17772 KB
01_random_26.txt AC 72 ms 20796 KB
01_random_27.txt AC 53 ms 18316 KB
01_random_28.txt AC 22 ms 10968 KB
01_random_29.txt AC 2 ms 3908 KB
01_random_30.txt AC 6 ms 4672 KB
01_random_31.txt AC 23 ms 10188 KB
01_random_32.txt AC 85 ms 16900 KB
01_random_33.txt AC 1 ms 3572 KB
01_random_34.txt AC 18 ms 9496 KB
01_random_35.txt AC 18 ms 7152 KB
01_random_36.txt AC 4 ms 5272 KB
01_random_37.txt AC 49 ms 15052 KB
01_random_38.txt AC 35 ms 9744 KB
01_random_39.txt AC 7 ms 5196 KB
01_random_40.txt AC 108 ms 20804 KB
01_random_41.txt AC 62 ms 20276 KB
01_random_42.txt AC 62 ms 20396 KB
01_random_43.txt AC 19 ms 7136 KB
01_random_44.txt AC 39 ms 10396 KB
01_random_45.txt AC 4 ms 4496 KB
02_handmade_46.txt AC 63 ms 20648 KB
02_handmade_47.txt AC 1 ms 3484 KB
02_handmade_48.txt AC 23 ms 12888 KB
02_handmade_49.txt AC 1 ms 3512 KB
02_handmade_50.txt AC 108 ms 20656 KB
02_handmade_51.txt AC 27 ms 12972 KB
02_handmade_52.txt AC 67 ms 20712 KB
02_handmade_53.txt AC 47 ms 19024 KB


2025-03-05 (Wed)
20:48:01 +00:00