# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
915913 | 2024-01-24 21:51:42 | nightfal | 고대 책들 (IOI17_books) | C++14 | 42 / 100 | 898 ms | 1048576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <cstdio>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <tuple>
#include <climits>
using namespace std;
bool isSubtask3(int s) {return s==0;}
bool isSubtask4(int n) {return n<=1000;}
long long subtask3(vector<int> p, int s = 0, int e = -1 , int dir = 1) {
int n = p.size(), last = s;
if (e==-1) e = n-1;
long long total = 0;
for(int i=s; dir==1 && i<=e || dir==-1 && i>=e; i += dir) {
if (i==p[i]) continue;
if (dir*(i-last) > 0) total += abs(i-last)*2;
total += abs(p[i]-i);
last = dir==1? max(last,p[i]):min(last,p[i]);
}
return total;
}
tuple<int,int,long long> extend(vector<int> p, int l, int r, int lmost, int rmost, int move) {
int n = p.size();
while(l> lmost || r < rmost) {
int idx;
if (l > max(lmost,0)) idx == --l;
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
컴파일 시 표준 에러 (stderr) 메시지
books.cpp: In function 'long long int subtask3(std::vector<int>, int, int, int)': books.cpp:18:25: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 18 | for(int i=s; dir==1 && i<=e || dir==-1 && i>=e; i += dir) { | ~~~~~~~^~~~~~~ books.cpp: In function 'std::tuple<int, int, long long int> extend(std::vector<int>, int, int, int, int, int)': books.cpp:30:35: warning: value computed is not used [-Wunused-value] 30 | if (l > max(lmost,0)) idx == --l; | ~~~~^~~~~~ books.cpp:31:42: warning: value computed is not used [-Wunused-value] 31 | else if (r < min(rmost,n-1)) idx == ++r; | ~~~~^~~~~~ books.cpp: In function 'long long int subtask4(std::vector<int>, int)': books.cpp:76:15: warning: unused variable 'move' [-Wunused-variable] 76 | long long move = 0; | ^~~~ books.cpp: In function 'long long int fulltask(std::vector<int>, int)': books.cpp:99:24: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=] 99 | printf("total=%d, sumL=%d, sumR=%d, moveL=%d, moveR=%d\n",total,sumL,sumR,moveL,moveR); | ~^ ~~~~~ | | | | int long long int | %lld books.cpp:99:33: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long long int' [-Wformat=] 99 | printf("total=%d, sumL=%d, sumR=%d, moveL=%d, moveR=%d\n",total,sumL,sumR,moveL,moveR); | ~^ ~~~~ | | | | int long long int | %lld books.cpp:99:42: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long long int' [-Wformat=] 99 | printf("total=%d, sumL=%d, sumR=%d, moveL=%d, moveR=%d\n",total,sumL,sumR,moveL,moveR); | ~^ ~~~~ | | | | int long long int | %lld books.cpp:99:52: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long long int' [-Wformat=] 99 | printf("total=%d, sumL=%d, sumR=%d, moveL=%d, moveR=%d\n",total,sumL,sumR,moveL,moveR); | ~^ ~~~~~ | | | | int long long int | %lld books.cpp:99:62: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long long int' [-Wformat=] 99 | printf("total=%d, sumL=%d, sumR=%d, moveL=%d, moveR=%d\n",total,sumL,sumR,moveL,moveR); | ~^ ~~~~~ | | | | int long long int | %lld books.cpp:102:73: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 102 | if(right <= n-1 && (left < 0 || moveR < moveL || moveR == moveL && right <= rightmost)) { | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ books.cpp:111:78: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 111 | else if(0 <= left && (right > n-1 || moveR > moveL || moveR == moveL && right > rightmost)) { | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ books.cpp:121:20: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=] 121 | printf("total=%d, sumL=%d, sumR=%d, moveL=%d, moveR=%d\n",total,sumL,sumR,moveL,moveR); | ~^ ~~~~~ | | | | int long long int | %lld books.cpp:121:29: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long long int' [-Wformat=] 121 | printf("total=%d, sumL=%d, sumR=%d, moveL=%d, moveR=%d\n",total,sumL,sumR,moveL,moveR); | ~^ ~~~~ | | | | int long long int | %lld books.cpp:121:38: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long long int' [-Wformat=] 121 | printf("total=%d, sumL=%d, sumR=%d, moveL=%d, moveR=%d\n",total,sumL,sumR,moveL,moveR); | ~^ ~~~~ | | | | int long long int | %lld books.cpp:121:48: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long long int' [-Wformat=] 121 | printf("total=%d, sumL=%d, sumR=%d, moveL=%d, moveR=%d\n",total,sumL,sumR,moveL,moveR); | ~^ ~~~~~ | | | | int long long int | %lld books.cpp:121:58: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long long int' [-Wformat=] 121 | printf("total=%d, sumL=%d, sumR=%d, moveL=%d, moveR=%d\n",total,sumL,sumR,moveL,moveR); | ~^ ~~~~~ | | | | int long long int | %lld books.cpp: In function 'std::tuple<int, int, long long int> extend(std::vector<int>, int, int, int, int, int)': books.cpp:32:26: warning: 'idx' is used uninitialized in this function [-Wuninitialized] 32 | move += abs(p[idx]-idx); | ^
# | 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... |