Submission #40025

# Submission time Handle Problem Language Result Execution time Memory
40025 2018-01-25T11:44:55 Z funcsr 구간 성분 (KOI15_interval) C++14
61 / 100
589 ms 131072 KB
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

string S, T;
set<vector<int>> mp;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> S >> T;
  rep(l, S.size()) {
    vector<int> cnt(26, 0);
    for (int r=l; r<S.size(); r++) {
      cnt[S[r]-'a']++;
      mp.insert(cnt);
    }
  }
  int m = 0;
  rep(l, T.size()) {
    vector<int> cnt(26, 0);
    for (int r=l; r<T.size(); r++) {
      cnt[T[r]-'a']++;
      if (mp.find(cnt) != mp.end()) m = max(m, r-l+1);
    }
  }
  cout << m << "\n";
  return 0;
}

Compilation message

interval.cpp: In function 'int main()':
interval.cpp:17:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i, n) for (int i=0; i<(n); i++)
                                  ^
interval.cpp:32:3: note: in expansion of macro 'rep'
   rep(l, S.size()) {
   ^
interval.cpp:34:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int r=l; r<S.size(); r++) {
                    ^
interval.cpp:17:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i, n) for (int i=0; i<(n); i++)
                                  ^
interval.cpp:40:3: note: in expansion of macro 'rep'
   rep(l, T.size()) {
   ^
interval.cpp:42:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int r=l; r<T.size(); r++) {
                    ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2184 KB Output is correct
2 Correct 1 ms 2316 KB Output is correct
3 Correct 2 ms 2184 KB Output is correct
4 Correct 3 ms 2976 KB Output is correct
5 Correct 3 ms 2844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 77 ms 15252 KB Output is correct
2 Correct 84 ms 18684 KB Output is correct
3 Correct 50 ms 2976 KB Output is correct
4 Correct 30 ms 2184 KB Output is correct
5 Correct 104 ms 21588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 444 ms 81120 KB Output is correct
2 Correct 467 ms 83892 KB Output is correct
3 Correct 404 ms 82968 KB Output is correct
4 Correct 434 ms 81252 KB Output is correct
5 Correct 388 ms 83760 KB Output is correct
6 Correct 409 ms 81648 KB Output is correct
7 Correct 410 ms 83760 KB Output is correct
8 Correct 408 ms 84024 KB Output is correct
9 Correct 418 ms 83892 KB Output is correct
10 Correct 431 ms 83496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 589 ms 33468 KB Output is correct
2 Memory limit exceeded 471 ms 131072 KB Memory limit exceeded
3 Halted 0 ms 0 KB -