Curs 1. Probleme de incălzire

https://infoarena.ro/problema/rascoala

vector<pair<int,int>>poz;
int a[NMAX];

for(int i )
  for(int j) {
      cin >> x;
      poz[x].push_back({x,y})}
     
  for(int i = 0; i <= 1000000; ++i)
    if(poz[i].size()> 0){
      a[++cnt] = i;
    }
  min = a[1];
  int total=poz[min].size()
  int i;
  for(i =2;i <= cnt; ++i) {
    if((a[i] - min) * total <=k) {
      k -= (a[i] - min) * total;
      min = a[i];
      total += poz[i].size();
    }
    else break;

     if(k > 0){
      c = k/total;
       
    }
    cout << min+c  << "\n" << total;
  }
  for(int i = 1; i <= min; ++i) {
    for( auto x : poz[i]) {
            max1 = max(max1, x.first + x.second);
            min1= min(min1, x.first + x.second);
            max2 = max(max2, x.second - x.first);
            min2 = min(min2, x.second - x.first);
            
        }
   }
  cout << max(max1 - min1, max2-min2);

https://infoarena.ro/problema/cocochanel
https://infoarena.ro/problema/subsecvente2


bool  verificare(int lung) {
  unordered_,map<long long, int>m;
  long long codif=0;
  putere = 1<<(lung-1)
  ababa
 2^2  2^1  2^0
  0     1       0    
  for(int sir = 1; sir <= N; ++ sir;)
  for(int i = 1; i <= lung; ++i) {
      codif= codif * 2 + (a[[sir][i] - 'a')
      if(sir == 1)
      m[codif] = 1;
      else
        if(m[codif] == sir-1) {
            m[codif] = sir; 
            if(sir == N)
              return true;
            }

  }
  for(int i = lung+1; i <= strlen(a[sir]); ++i) {
      codif -= (a[sir][i-lung] - 'a') * putere;
      codif *= 2;
      codif += a[sir][i] - 'a';
      if(sir == 1)
       m[codif] = 1;
       else
        if(m[codif] === sir-1) {
            m[codif] = sir; 
              if(sir === N)
                return true;
            }
    }
}

}
https://infoarena.ro/problema/flori4

 DP[i] = in cate moduri pot sa grupez primele i flori, si floarea i sa fie inclusa in buchet
 dp[i] = dp[i-2] + dp[i-3] +....dp[1]
 dp[1] = 1;
 dp[2] = 1;
 s = dp[1];
 for(int i = 3; i <= n; ++i)
   {  dp[i] = (1 + s) % mod;
     s = (s +dp[i-1])%mod;
   }
RASPUNS: (s+dp[n]) % mod;

https://infoarena.ro/problema/mofocarburi
https://infoarena.ro/problema/clepsidra

MATRICE DE ADIACENTA
LISTE DE ADIACIENTA
LISTA DE MUCHII
int h[], min_h[]
vector<int>vecini[N];
void dfs(int x,int tata) {
viz[x] = 1;
  for( auto vecin : a[x]) {
    if(!viz[vecin]) {
     h[vecin] = h[x]+1;
      dfs(vecin,x);
     } 
  }
  min_h[x] = x;
 for( auto vecin : a[x]) {
    
    min_h[x] = min(min_h[x],h[vecin]);
  }
  if(min_h[x] ==h[x]-1) {
    puncte_critice.push_back(tata);
    critic[tata]++;
  }
}
int main(){
  cin >> n >> m;
  for(int i = 1; i <= m; ++i) {
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  for(auto pct : puncte_critice) {
  
    cout << (1 <<cirtic[pct] ) - 2
  }
  h[1] = 1;
  difs(1,0);
}


=======================
int h[], min_h[]
vector<int>vecini[N];
void dfs(int x,int tata) {
viz[x] = 1;
  for( auto vecin : a[x]) {
    if(!viz[vecin]) {
     h[vecin] = h[x]+1;
      dfs(vecin,x);
     } 
  }
}
int main(){
  cin >> n >> m;
  for(int i = 1; i <= m; ++i) {
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  h[1] = 1;
  dfs(1,0);
}

https://codeforces.com/contest/617/problem/E