| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 167508 | Thuleanx | 새로운 문제 (POI11_liz) | C++14 | 539 ms | 51088 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m; cin>>n>>m;
string s; cin>>s;
int p[n];
for (int i = 0; i < n; i++)
p[i] = (i?p[i-1]:0) + (s[i] == 'T' ? 2 : 1);
int st = 0, tt = n-1;
while (st < n && s[st] == 'T')
st++;
while (tt >= 0 && s[tt] == 'T')
tt--;
stringstream ss;
while (m--) {
int x; cin>>x;
if (p[n-1] - (st?p[st-1]:0) >= x) {
// always possible
int lo = st, hi = n-1;
int left = st?p[st-1]:0;
while (lo <= hi) {
int mid = lo+hi>>1;
if (p[mid] - left >= x)
hi = mid-1;
else lo = mid+1;
}
ss << st+1+(p[lo]-left>x) << " " << lo+1 << endl;
} else if (p[tt] >= x) {
// always possible
int lo = 0, hi = tt;
while (lo <= hi) {
int mid = lo+hi>>1;
if (p[tt] - (mid?p[mid-1]:0) >= x)
lo = mid+1;
else hi = mid-1;
}
ss << hi+1 << " " << tt + 1 - (p[tt] - (hi?p[hi-1]:0) > x) << endl;
} else {
// maybe not
int lo = 0, hi = n-1;
while (lo <= hi) {
int mid = lo+hi>>1;
if (p[mid] >= x) hi = mid-1;
else lo = mid+1;
}
if (p[lo] == x)
ss << 1 << " " << lo+1 << endl;
else
ss << "NIE" << endl;
}
}
cout << ss.str();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
