Submission #51810593
Source Code Expand
Copy
// !JOY#pragma GCC optimize("Ofast")#pragma GCC target("avx,avx2,fma")#include <bits/stdc++.h>#define ll long long#define ld long double#define pb(a) push_back(a)#define all(v) v.begin(), v.end()#define rall(v) v.rbegin(), v.rend()#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)#define coutyes cout<<"YES\n"#define coutno cout<<"NO\n"#define endl "\n"#define hell 1000000007using namespace std;int M = 1000000;int sieve[1000001];
// !JOY #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #define ll long long #define ld long double #define pb(a) push_back(a) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL) #define coutyes cout<<"YES\n" #define coutno cout<<"NO\n" #define endl "\n" #define hell 1000000007 using namespace std; int M = 1000000; int sieve[1000001]; void createSieve() { for (int i = 2; i <= M; i++) { sieve[i] = 1; } for (int i = 2; i * i <= M; i++) { if (sieve[i] == 1) { if (i == 2) { for (int j = i * i; j <= M; j += i) { sieve[j] = 2; } } else { for (int j = i * i; j <= M; j += 2 * i) { if (sieve[j] == 1) { sieve[j] = i; } } } } } } bool isPrime(ll n) { if (n <= 1) return false; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return true; } ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } vector<ll> factors(ll n) { vector<ll> f; for (ll x = 2; x*x <= n; x++) { while (n%x == 0) { f.push_back(x); n /= x; } } if (n > 1) f.push_back(n); return f; } ll powe(ll a, ll n) { ll r = 1; while (n) { if (n % 2) { r = ((r % hell) * (a % hell)) % hell; n--; } else { a = ((a % hell) * (a % hell)) % hell; n = n / 2; } } return r; } ll dx[] = {0, 0, 1, -1}; ll dy[] = {1, -1, 0, 0}; ll dfs(ll i, ll j, vector<vector<ll>> &vi, ll n, ll m, vector<vector<ll>> & v) { ll ans = 0; if (!vi[i][j]) { vi[i][j] = 1; ans = v[i][j]; for (int k = 0; k < 4; k++) { if (i + dx[k] >= 0 && i + dx[k] < n && j + dy[k] >= 0 && j + dy[k] < m && v[i + dx[k]][j + dy[k]] != 0 && vi[i + dx[k]][j + dy[k]] == 0) { ans += dfs(i + dx[k], j + dy[k], vi, n, m, v); } } } return ans; } const int N = 1e5+10; vector<int>g[N]; bool vis[N]; void _dfs(int vertex){ if(!vis[vertex]){ vis[vertex]=true; for (int child: g[vertex]) { if(!vis[child]) _dfs(child); } } } void solve() { string s; cin>>s; ll n=s.size(); map<string,ll>m; for(int i=0;i<n;i++){ string z=""; for(int j=i;j<n;j++){ z+=s[j]; m[z]++; } } cout<<m.size()<<endl; } int main() { fast_io; ll t; t=1; // cin>>t; while(t--) solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Substring |
User | Parzival01 |
Language | C++ 20 (gcc 12.2) |
Score | 200 |
Code Size | 2999 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 4212 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 1 ms | 3428 KB |
00_sample_02.txt | AC | 1 ms | 3420 KB |
00_sample_03.txt | AC | 1 ms | 3544 KB |
01_test_01.txt | AC | 1 ms | 3480 KB |
01_test_02.txt | AC | 2 ms | 3556 KB |
01_test_03.txt | AC | 2 ms | 3436 KB |
01_test_04.txt | AC | 3 ms | 4080 KB |
01_test_05.txt | AC | 3 ms | 4028 KB |
01_test_06.txt | AC | 2 ms | 3932 KB |
01_test_07.txt | AC | 2 ms | 4020 KB |
01_test_08.txt | AC | 2 ms | 4212 KB |
01_test_09.txt | AC | 3 ms | 3928 KB |
01_test_10.txt | AC | 3 ms | 3932 KB |