Submission #729889

# Submission time Handle Problem Language Result Execution time Memory
729889 2023-04-24T18:51:45 Z Denkata trapezoid (balkan11_trapezoid) C++14
Compilation error
0 ms 0 KB
v#include<bits/stdc++.h>
using namespace std;
const long long maxn = 1e5+3;
const long long maxq = 4e5+3;
const long long mod = 30013;
long long i,j,p,q,n,m,k;
pair <long long,long long> dp[maxn];
pair <long long,long long> a[maxn];

struct Trapeze
{
    long long a[5];///a b c d
}tr[maxn];
struct Coordinate
{
    long long val;
    long long type;
    long long ind;
};
vector <Coordinate> coordinates;
bool ul[maxq],ur[maxq];
pair <long long,long long> fen[maxq];
void upd(long long p,long long d,long long br)
{
    while(p<=maxq)
    {
        if(d>fen[p].first)
            fen[p] = {d,br};
        else if(d==fen[p].first)
            fen[p].second+=br,fen[p].second%=mod;
        p = (p|(p+1));
    }
}
pair <long long,long long> rsq(long long p)
{
    pair <long long,long long> ans={0,0};
    while(p>0)
    {
        if(ans.first<fen[p].first)
            ans = fen[p];
        else if(ans.first==fen[p].first)
            ans.second+=fen[p].second,ans.second%=mod;
        p = ((p&(p+1))-1);
    }
    return ans;
}
bool fff(Coordinate a,Coordinate b)
{
    return a.val<b.val;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>tr[i].a[1]>>tr[i].a[2]>>tr[i].a[3]>>tr[i].a[4];
        coordinates.push_back({tr[i].a[1],1,i});
        coordinates.push_back({tr[i].a[2],2,i});
        coordinates.push_back({tr[i].a[3],3,i});
        coordinates.push_back({tr[i].a[4],4,i});
    }
    sort(coordinates.begin(),coordinates.end(),fff);
    for(i=0;i<coordinates.size();i++)
    {
        auto t = coordinates[i];
        tr[t.ind].a[t.type] = i+1;
    }
    coordinates.push_back({4*n+2,1,n+1});
    tr[n+1].a[3]=4*n+2;
    upd(0,0,1);
    for(i=0;i<4*n+1;i++)
    {
        auto t = coordinates[i];
        if(t.type==1)
        {
            dp[t.ind] = rsq(tr[t.ind].a[3]);
            dp[t.ind].first++;
        }
        else if(t.type==2)
        {
            upd(tr[t.ind].a[4],dp[t.ind].first,dp[t.ind].second);
        }
    }
    pair <long long,long long> ans = rsq(4*n+3);
    cout<<ans.first<<" "<<ans.second<<endl;
    return 0;
}

Compilation message

trapezoid.cpp:1:2: error: stray '#' in program
    1 | v#include<bits/stdc++.h>
      |  ^
trapezoid.cpp:1:1: error: 'v' does not name a type
    1 | v#include<bits/stdc++.h>
      | ^
trapezoid.cpp:7:1: error: 'pair' does not name a type
    7 | pair <long long,long long> dp[maxn];
      | ^~~~
trapezoid.cpp:8:1: error: 'pair' does not name a type
    8 | pair <long long,long long> a[maxn];
      | ^~~~
trapezoid.cpp:20:1: error: 'vector' does not name a type
   20 | vector <Coordinate> coordinates;
      | ^~~~~~
trapezoid.cpp:22:1: error: 'pair' does not name a type
   22 | pair <long long,long long> fen[maxq];
      | ^~~~
trapezoid.cpp: In function 'void upd(long long int, long long int, long long int)':
trapezoid.cpp:27:14: error: 'fen' was not declared in this scope
   27 |         if(d>fen[p].first)
      |              ^~~
trapezoid.cpp: At global scope:
trapezoid.cpp:34:1: error: 'pair' does not name a type
   34 | pair <long long,long long> rsq(long long p)
      | ^~~~
trapezoid.cpp: In function 'int main()':
trapezoid.cpp:53:5: error: 'ios_base' has not been declared
   53 |     ios_base::sync_with_stdio(false);
      |     ^~~~~~~~
trapezoid.cpp:54:5: error: 'cin' was not declared in this scope
   54 |     cin.tie(NULL);
      |     ^~~
trapezoid.cpp:54:13: error: 'NULL' was not declared in this scope
   54 |     cin.tie(NULL);
      |             ^~~~
trapezoid.cpp:1:1: note: 'NULL' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
  +++ |+#include <cstddef>
    1 | v#include<bits/stdc++.h>
trapezoid.cpp:55:5: error: 'cout' was not declared in this scope
   55 |     cout.tie(NULL);
      |     ^~~~
trapezoid.cpp:60:9: error: 'coordinates' was not declared in this scope; did you mean 'Coordinate'?
   60 |         coordinates.push_back({tr[i].a[1],1,i});
      |         ^~~~~~~~~~~
      |         Coordinate
trapezoid.cpp:65:10: error: 'coordinates' was not declared in this scope; did you mean 'Coordinate'?
   65 |     sort(coordinates.begin(),coordinates.end(),fff);
      |          ^~~~~~~~~~~
      |          Coordinate
trapezoid.cpp:65:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   65 |     sort(coordinates.begin(),coordinates.end(),fff);
      |     ^~~~
      |     short
trapezoid.cpp:79:13: error: 'dp' was not declared in this scope; did you mean 'p'?
   79 |             dp[t.ind] = rsq(tr[t.ind].a[3]);
      |             ^~
      |             p
trapezoid.cpp:79:25: error: 'rsq' was not declared in this scope
   79 |             dp[t.ind] = rsq(tr[t.ind].a[3]);
      |                         ^~~
trapezoid.cpp:84:32: error: 'dp' was not declared in this scope; did you mean 'p'?
   84 |             upd(tr[t.ind].a[4],dp[t.ind].first,dp[t.ind].second);
      |                                ^~
      |                                p
trapezoid.cpp:87:5: error: 'pair' was not declared in this scope
   87 |     pair <long long,long long> ans = rsq(4*n+3);
      |     ^~~~
trapezoid.cpp:87:11: error: expected primary-expression before 'long'
   87 |     pair <long long,long long> ans = rsq(4*n+3);
      |           ^~~~
trapezoid.cpp:88:11: error: 'ans' was not declared in this scope
   88 |     cout<<ans.first<<" "<<ans.second<<endl;
      |           ^~~
trapezoid.cpp:88:39: error: 'endl' was not declared in this scope
   88 |     cout<<ans.first<<" "<<ans.second<<endl;
      |                                       ^~~~