Submission #1453470
Source Code Expand
#include<bits/stdc++.h> #include<sstream> #include<ext/pb_ds/tree_policy.hpp> using namespace std; #define mod 1000000007 #define all(v) v.begin(),v.end() #define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++) #define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--) #define strep(it,v) for(it=v.begin();it!=v.end();++it) #define ii pair<pair<ll,ll>,pair<ll,ll> > #define MP make_pair #define pb push_back #define f first #define se second #define ll long long int #define vi vector<int> #define rs resize const int N = 100009; string a; vector<vi> v(26); int i,n,j,k,sz,len; bool flag = false; int main() { std::ios::sync_with_stdio(false); cin>>a; n = a.length(); rep(i,0,n) v[a[i]-'a'].pb(i); for(k=0;k<26 && !flag;k++) { sz = v[k].size(); for(i=0;i<sz && !flag;i++) for(j=i+1;j<sz && !flag;j++) { len = v[k][j] - v[k][i] + 1; if(j - i + 1 > len/2) flag = true; } } if(flag) printf("%d %d",v[k - 1][i - 1] + 1,v[k - 1][j - 1] + 1); else printf("-1 - 1"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Be Together |
User | Tarun_ |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1098 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | WA | 1 ms | 256 KB |
0_001.txt | WA | 1 ms | 256 KB |
0_002.txt | WA | 1 ms | 256 KB |
0_003.txt | WA | 1 ms | 256 KB |
1_004.txt | WA | 1 ms | 256 KB |
1_005.txt | WA | 1 ms | 256 KB |
1_006.txt | WA | 1 ms | 256 KB |
1_007.txt | WA | 1 ms | 256 KB |
1_008.txt | WA | 1 ms | 256 KB |
1_009.txt | WA | 1 ms | 256 KB |
1_010.txt | WA | 1 ms | 256 KB |
1_011.txt | WA | 1 ms | 256 KB |
1_012.txt | WA | 1 ms | 256 KB |
1_013.txt | WA | 1 ms | 256 KB |
1_014.txt | WA | 1 ms | 256 KB |