# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
26288 | 2017-06-29T05:08:27 Z | 까제비(#1110) | Zagrade (COI17_zagrade) | C++14 | 3 ms | 4948 KB |
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++) #define REPO(i,n) for(int (i)=1; (i)<=(int)(n); (i)++) #define SZ(v) ((int)(v).size()) #define ALL(v) (v).begin(),(v).end() #define one first #define two second typedef long long ll; typedef pair<int, int> pi; const int INF = 0x3f2f1f0f; const ll LINF = 1ll * INF * INF; const int MAX_N = 6e5 + 100; int N, Lv[MAX_N]; char S[MAX_N]; int main() { cin >> N; scanf("%s", S); int lv = MAX_N/2; ll ans = 0; for(int i=0; i<N; i++) { if(S[i] == '(') { Lv[lv]++; lv++; } else { Lv[lv] = 0; lv--; ans += Lv[lv]; } } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 4948 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 4948 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 4948 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |