답안 #754710

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
754710 2023-06-08T12:08:26 Z Unforgettablepl Programiranje (COCI17_programiranje) C++17
80 / 80
33 ms 13772 KB
/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define f first
#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("haybales.in","r",stdin);
//    freopen("haybales.out","w",stdout);
    string s;ll q;
    cin >> s >> q;
    s.insert(0," ");
    vector<vector<ll>> prefix(s.length()+1,vector<ll>(26));
    for (int i = 1; i < s.length(); i++) {
        prefix[i] = prefix[i-1];
        prefix[i][s[i]-'a']++;
    }
    for (int i = 0; i < q; i++) {
        ll a,b,c,d;
        cin >> a >> b >> c >> d;
        for (int j = 0; j < 26; j++) {
            if(prefix[b][j]-prefix[a-1][j]!=prefix[d][j]-prefix[c-1][j]){
                cout << "NE\n";goto skip;
            }
        }
        cout << "DA\n";
        skip:
        continue;
    }
}

Compilation message

programiranje.cpp: In function 'int main()':
programiranje.cpp:27:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for (int i = 1; i < s.length(); i++) {
      |                     ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 32 ms 13772 KB Output is correct
7 Correct 30 ms 13684 KB Output is correct
8 Correct 29 ms 13704 KB Output is correct
9 Correct 30 ms 13736 KB Output is correct
10 Correct 33 ms 13692 KB Output is correct