제출 #1267821

#제출 시각아이디문제언어결과실행 시간메모리
1267821michael12Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++20
0 / 100
637 ms327680 KiB
#include<bits/stdc++.h> #define ff first #define ss second #define pb push_back #define mp make_pair using namespace std; // bool vis[100][100]; // bool vis1[100][100]; // void dfs(int n1, int m1, vector<string>& gr, int ba, int mu){ // vis[n1][m1] = true; // int dx[4] = {0, 0, -1, 1}; // int dy[4] = {1, -1, 0, 0}; // for(int i = 0; i < 4; i++){ // int nx = n1 + dx[i]; // int ny = m1 + dy[i]; // if(gr[nx][ny] == '.' && nx >= 0 && ny >= 0 && nx < ba && ny < mu && !vis[nx][ny]){ // dfs(nx, ny, gr, ba, mu); // } // } // } // void dfs1(int n, int m, vector<vector<int>>& gr, int ba, int mu){ // vis[n][m] = true; // int dx[4] = {0, 0, 1, -1}; // int dy[4] = {1, -1, 0, 0}; // for(int i = 0; i < 4; i++){ // int nx = n + dx[i]; // int ny = m + dy[i]; // } // } // int main(){ // int n, m; // cin >> n >> m; // vector<string> gr(n); // for(int i = 0; i < n; i++){ // cin >> gr[i]; // } // int ans = 0; // for(int i = 0; i < n; i++){ // for(int j = 0; j < m; j++){ // if(gr[i][j] == '.'){ // dfs(i, j, gr, n, m); // ans++; // } // } // } // cout << ans; int main(){ int n,m; cin >> n >> m; vector<int> a(n),w; for(int i = 0; i < n; i++){ cin >> a[i]; } set<int> st; while(m--){ int l, r, k; cin >> l >> r >> k; for(int i = l; i < r - 1; i++){ for(int j = i + 1; j < r; j++){ w.push_back(a[i] + a[j]); } } if(k >= *max_element(w.begin(), w.end())){ cout << "1"; cout << endl; } else{ cout << "0"; cout << endl; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...