Submission #391102

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3911022021-04-17 20:49:37nafis_shifatStreet Lamps (APIO19_street_lamps)C++14
100 / 100
1177 ms24908 KiB
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define f first
#define s second
using namespace std;
const int mxn=3e5+5;
const int inf=1e9;
int a[mxn];
int ans[mxn] = {};
int n;
struct BIT
{
int bit[mxn] = {};
void update(int p,int v) {
if(p==0) return;
for(;p< mxn; p+= p&-p) bit[p] += v;
}
int query(int p) {
int r=0;
for(;p>0;p-=p&-p) r += bit[p];
return r;
}
int query(int a,int b) {
return query(b) - query(a - 1);
}
} bt1,bt2;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

street_lamps.cpp: In function 'void solve(int, int)':
street_lamps.cpp:87:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   87 |  int mid = l + r >> 1;
      |            ~~^~~
street_lamps.cpp: In function 'int main()':
street_lamps.cpp:145:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  145 |     int mid = lo + hi >> 1;
      |               ~~~^~~~
street_lamps.cpp:161:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  161 |     int mid = lo + hi >> 1;
      |               ~~~^~~~
street_lamps.cpp:194:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<QUERY>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  194 |  for(int i = 0; i < Qs.size(); i++) {
      |                 ~~^~~~~~~~~~~
street_lamps.cpp:134:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  134 |   scanf("%s",p);
      |   ~~~~~^~~~~~~~
street_lamps.cpp:137:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  137 |    scanf("%d",&x);
      |    ~~~~~^~~~~~~~~
street_lamps.cpp:183:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  183 |    scanf("%d%d",&a,&b);
      |    ~~~~~^~~~~~~~~~~~~~
#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...