Submission #1869754
Source Code Expand
//while (clock()<=69*CLOCKS_PER_SEC) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define sim template < class c #define ris return * this #define dor > debug & operator << #define eni(x) sim > typename \ enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) { sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...); struct debug { #ifdef LOCAL ~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; } #else sim dor(const c&) { ris; } #endif }; #define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " #define shandom_ruffle random_shuffle const int nax=100*1007; int k; char wcz[nax]; int n; int oj[nax]; int sum[nax]; int fin(int v) { if (v!=oj[v]) oj[v]=fin(oj[v]); return oj[v]; } void uni(int v, int u) { oj[fin(u)]=fin(v); } int main() { scanf("%s", wcz+1); k=strlen(wcz+1); wcz[0]='a'; wcz[k+1]='a'; for (int i=0; i<=k; i++) oj[i]=i; scanf("%d", &n); for (int i=1; i<=n; i++) { int l, r; scanf("%d%d", &l, &r); uni(l-1, r); } for (int i=1; i<=k/2+1; i++) uni(i-1, k-(i-1)); for (int i=0; i<=k; i++) sum[fin(i)]+=(wcz[i]-wcz[i+1]); for (int i=0; i<=k; i++) { if (sum[i]%26) { printf("NO\n"); return 0; } } printf("YES\n"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Combination Lock |
User | Stonefeang |
Language | C++14 (GCC 5.4.1) |
Score | 1000 |
Code Size | 1920 Byte |
Status | AC |
Exec Time | 24 ms |
Memory | 896 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:69:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s", wcz+1); ^ ./Main.cpp:75:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ ./Main.cpp:79:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d", &l, &r); ^
Judge Result
Set Name | sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1000 / 1000 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt, sample-03.txt |
All | sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, 01-36.txt, 01-37.txt, 01-38.txt, 01-39.txt, 01-40.txt, 01-41.txt, 01-42.txt, 01-43.txt, 01-44.txt, 01-45.txt, 01-46.txt, 01-47.txt, 01-48.txt, 01-49.txt, 01-50.txt, 01-51.txt, 01-52.txt, 01-53.txt, 01-54.txt, 01-55.txt, 01-56.txt, 01-57.txt, 01-58.txt, 01-59.txt, 01-60.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 16 ms | 256 KB |
01-02.txt | AC | 16 ms | 256 KB |
01-03.txt | AC | 18 ms | 256 KB |
01-04.txt | AC | 24 ms | 896 KB |
01-05.txt | AC | 16 ms | 256 KB |
01-06.txt | AC | 16 ms | 256 KB |
01-07.txt | AC | 16 ms | 256 KB |
01-08.txt | AC | 17 ms | 256 KB |
01-09.txt | AC | 17 ms | 256 KB |
01-10.txt | AC | 17 ms | 256 KB |
01-11.txt | AC | 18 ms | 384 KB |
01-12.txt | AC | 19 ms | 384 KB |
01-13.txt | AC | 20 ms | 384 KB |
01-14.txt | AC | 22 ms | 640 KB |
01-15.txt | AC | 23 ms | 768 KB |
01-16.txt | AC | 24 ms | 896 KB |
01-17.txt | AC | 24 ms | 896 KB |
01-18.txt | AC | 24 ms | 896 KB |
01-19.txt | AC | 24 ms | 896 KB |
01-20.txt | AC | 24 ms | 896 KB |
01-21.txt | AC | 24 ms | 896 KB |
01-22.txt | AC | 24 ms | 896 KB |
01-23.txt | AC | 24 ms | 896 KB |
01-24.txt | AC | 3 ms | 896 KB |
01-25.txt | AC | 3 ms | 896 KB |
01-26.txt | AC | 3 ms | 896 KB |
01-27.txt | AC | 3 ms | 896 KB |
01-28.txt | AC | 5 ms | 896 KB |
01-29.txt | AC | 16 ms | 256 KB |
01-30.txt | AC | 16 ms | 256 KB |
01-31.txt | AC | 16 ms | 256 KB |
01-32.txt | AC | 17 ms | 256 KB |
01-33.txt | AC | 17 ms | 384 KB |
01-34.txt | AC | 20 ms | 384 KB |
01-35.txt | AC | 22 ms | 640 KB |
01-36.txt | AC | 23 ms | 768 KB |
01-37.txt | AC | 24 ms | 896 KB |
01-38.txt | AC | 23 ms | 896 KB |
01-39.txt | AC | 24 ms | 896 KB |
01-40.txt | AC | 24 ms | 896 KB |
01-41.txt | AC | 24 ms | 896 KB |
01-42.txt | AC | 24 ms | 896 KB |
01-43.txt | AC | 24 ms | 896 KB |
01-44.txt | AC | 24 ms | 896 KB |
01-45.txt | AC | 24 ms | 896 KB |
01-46.txt | AC | 23 ms | 896 KB |
01-47.txt | AC | 24 ms | 896 KB |
01-48.txt | AC | 24 ms | 896 KB |
01-49.txt | AC | 24 ms | 896 KB |
01-50.txt | AC | 24 ms | 896 KB |
01-51.txt | AC | 2 ms | 896 KB |
01-52.txt | AC | 2 ms | 896 KB |
01-53.txt | AC | 2 ms | 896 KB |
01-54.txt | AC | 3 ms | 896 KB |
01-55.txt | AC | 5 ms | 896 KB |
01-56.txt | AC | 11 ms | 896 KB |
01-57.txt | AC | 11 ms | 896 KB |
01-58.txt | AC | 11 ms | 896 KB |
01-59.txt | AC | 11 ms | 896 KB |
01-60.txt | AC | 11 ms | 896 KB |
sample-01.txt | AC | 1 ms | 256 KB |
sample-02.txt | AC | 1 ms | 256 KB |
sample-03.txt | AC | 1 ms | 256 KB |