Submission #84005

#TimeUsernameProblemLanguageResultExecution timeMemory
84005ekremPort Facility (JOI17_port_facility)C++98
0 / 100
2 ms504 KiB
#include <bits/stdc++.h> #define st first #define nd second #define mp make_pair #define pb push_back #define mod 1000000007 #define N 1000005 using namespace std; int n, fen1[N], fen2[N]; pair < int , int > x[N]; long long ans = 1; void up1(int x, int y){ for(; x <= n+n; x += x&-x) fen1[x] += y;} int qu1(int x){ int top = 0; for(; x > 0; x -= x&-x) top += fen1[x]; return top;} void up2(int x, int y){ for(; x <= n+n; x += x&-x) fen2[x] += y;} int qu2(int x){ int top = 0; for(; x > 0; x -= x&-x) top += fen2[x]; return top;} int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); scanf("%d",&n); for(int i = 1; i <= n; i++) scanf("%d %d",&x[i].st ,&x[i].nd); sort(x + 1, x + n + 1); for(int i = 1; i <= n; i++){ int q1 = qu1(x[i].nd) - qu1(x[i].st); int q2 = qu2(x[i].nd) - qu2(x[i].st); if(q1 and q2){ ans = 0; break; } if(!q1 and !q2) ans = ans*2%mod; if(!q1){ up1(x[i].nd, 1); } else up2(x[i].nd, 1); } printf("%lld\n", ans); return 0; }

Compilation message (stderr)

port_facility.cpp: In function 'int main()':
port_facility.cpp:34:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
port_facility.cpp:36:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&x[i].st ,&x[i].nd);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...