diff --git a/Taski/file_storage/storage/0c/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8.meta.json b/Taski/file_storage/storage/0c/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8.meta.json new file mode 100644 index 00000000..ed8ede65 --- /dev/null +++ b/Taski/file_storage/storage/0c/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8.meta.json @@ -0,0 +1,4 @@ +{ + "bucket_id": "0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8", + "trash_time": "2026-05-16T08:28:06.801064-04:00" +} \ No newline at end of file diff --git a/Taski/file_storage/storage/0c/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8/checker.cpp b/Taski/file_storage/storage/0c/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8/checker.cpp new file mode 100644 index 00000000..f7f223a4 --- /dev/null +++ b/Taski/file_storage/storage/0c/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8/checker.cpp @@ -0,0 +1,36 @@ +#include + +using namespace std; + +int main(int argv, char **argc) { + if (argv != 3) { + return -1; + } + + string correct_output_file = argc[1]; + string suspect_output_file = argc[2]; + + ifstream correct(correct_output_file); + ifstream suspect(suspect_output_file); + + while (true) { + string correct_output; + bool correct_eol = !(correct >> correct_output); + string suspect_output; + bool suspect_eol = !(suspect >> suspect_output); + if (correct_eol != suspect_eol) { + cout << "WA"; + return 0; + } + if (correct_eol) { + break; + } + if (correct_output != suspect_output) { + cout << "WA"; + return 0; + } + } + + cout << "OK"; + return 0; +} \ No newline at end of file diff --git a/Taski/file_storage/storage/0c/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8/solution.cpp b/Taski/file_storage/storage/0c/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8/solution.cpp new file mode 100644 index 00000000..d6284d4c --- /dev/null +++ b/Taski/file_storage/storage/0c/0c5fe950363fc0aeb7d80c5fe950363fc0aeb7d8/solution.cpp @@ -0,0 +1,72 @@ +#include +#include +#include +#include +using namespace std; +int n,inf=1e9; +vector segment_tree,ar; +void build(int now,int begin,int end) +{ + if (end==begin) + { + segment_tree[now]=end; + } + else + { + build(now*2,begin,(begin+end)/2); + build(now*2+1,(begin+end)/2+1,end); + if (ar[segment_tree[now*2]]>ar[segment_tree[now*2+1]]) segment_tree[now]=segment_tree[now*2]; + else segment_tree[now]=segment_tree[now*2+1]; + } +} +int maxsegment(int now,int left,int right,int begin,int end) +{ + if (end=1)&&(y>=1)) + { + if (ar[x]=1) + { + return x; + } + else + { + return y; + } + } +} +int main() +{ + int k; + cin>>n; + ar.resize(n+1); + segment_tree.resize(4*n+1); + for (int i=1;i<=n;i++) + { + cin>>ar[i]; + } + build(1,1,n); + cin>>k; + for (int i=1;i<=k;i++) + { + int l,r; + cin>>l>>r; + int x=maxsegment(1,1,n,l,r); + cout<